Skip to content

Provides utilities to synch local file structure to AWS S3 and vice versa.

Notifications You must be signed in to change notification settings

ht-fizz/aws-s3-synch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

  • The aws-s3-synch is a nodejs wrapper which is great for synching local folder/files to s3 bucket folder and vice versa.
  • Major use cases include automation of deployment of static websites or uploading local folder(s) to Amazon s3.
  • Facilitates simulation of actions (without actually performing) by tweaking certain parameters.

Installation

Usage

synchToS3

//include respective libraries
var awsSynch = require("aws-s3-synch");
var path = require("path");

awsSynch.synchToS3({
	// [Required] source directory path
	source: path.join(__dirname),  // --> this one will synch from current working directory

	// [Required] Destination path including both bucket and folder information
	destination: "s3://<BUCKET_NAME>/folder1/folder2/",   				 

	// [Required] true means simulate, false means perform respective action in bucket
	test: true,																				 

	// [Required] delete destination objects with no corresponding file.	
	deleteRemoved: true,															 

	// [Required] files.exclude will contain files that are not supposed to be synched.	
	excludeFile: path.join(__dirname, "files.exclude") 

});

synchFromS3

awsSynch.synchFromS3({

	// [Required] Source directory or file path on AWS
	source: `s3://<BUCKET_NAME>/<FULL_PATH_TO_FOLDER_OR_OBJECT>`,

	// [Required] Destination directory path on target machine.
	destination: path.join(__dirname), // this one will synch in current working directory

	// [Required] Skip if respective file already exists in destination directory
	skipExisting: true,

	// [Required] For an operation, it takes precedence on skipExisting
	force: false,

	// [Required] true means simulate, false means perform respective action in bucket
	test: false,


	// [Optional, Default: false] if download fails due to slow internet or somehow, use continue: true to resume
	continue: false
});

Example content of files.exclude

.DS_Store
*.gz

Note: Its not supposed to work in browser. Not a client side library.

About

Provides utilities to synch local file structure to AWS S3 and vice versa.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published