GithubHelp home page GithubHelp logo

s3-util's Introduction

#s3-util

High-level utility for dealing with S3.

Enables syncronizing a local directory with a remote s3 bucket (uploading local files, deleting remote files not present locally).

Usage via the Command Line

# Install as a global executable
$ npm install -g s3-util
$ s3-util -h # print help

Usage via the API

# Install as a local package
$ npm install --save s3-util
// Inside a JavaScript file...

var s3Util = require('s3-util');

// Construct the client using keys
s3Util('my-s3-bucket', {
  awsAccessKeyId: 'abcdef',
  awsSecretAccessKey: '123456'
}).then(function(client){
  // operations on client
}).catch(function(err){
  // caught async errors
});

// Construct the client using EC2 IAM Role
s3Util('my-s3-bucket', {
  awsIAMRole: 'my-role'
}).then(function(client){
  // operations on client
}).catch(function(err){
  // caught async errors
});

// Synchronizes a local file, directory, or glob pattern with an s3 destination
// if a directory is passed in, all files in the S3 destination which are not
// present locally will be deleted.
client.sync(localSource, s3DestinationPath, uploadOptions);

client.copy(s3SourceDirectory, s3DestinationDirectory);

client.diff(localDirectoryPath, s3DirectoryPath);

client.head(s3FilePath);
client.list(s3DirectoryPath);
client.updateAcl(s3Path, aclString);

client.putStream(stream, s3DestinationPath, uploadOptions);
client.putFile(localFilePath, s3DestinationPath, uploadOptions);

client.deleteFile(s3FilePath);
client.deleteMultiple([s3FilePath1, s3FilePath2]);
client.deleteDirectory(s3DirectoryPath);

s3-util's People

Contributors

nigelkibodeaux avatar unsetbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.