Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aws-s3-connector

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-s3-connector

Amazon WebService S3 Connector

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

AWS S3 Connector

Tired of all the hassles downloading, removing from and uploading to Amazon S3? The solution is here!

Install

npm install --save aws-s3-connector

Initialize Bucket

  • With CoffeeScript
S3Connector = require 'aws-s3-connector'

Storage = new S3Connector
  credentials: './credentials/aws.json'
  Bucket: 'BUCKET_NAME'
  • With JavaScript
var S3Connector = require('aws-s3-connector');

var Storage = new S3Connector({
  credentials: './credentials/aws.json',
  Bucket: 'BUCKET_NAME'
});

Download File

The Bucket is already defined in the Storage! You only need to pass the folder and filename inside S3 as remoteFile.

download 'remoteFile', 'localFile', callback
# or
download 'remoteFile', Buffer, callback
  • With CoffeeScript
Storage.download 'from-nosql/test.json', './downloads/test.json', (err) ->
  return console.error err if err
  console.log 'file downloaded'
  • With JavaScript
Storage.download('from-nosql/test.json', './downloads/test.json', function(err) {
  if (err) {
    return console.error(err);
  }
  console.log('file downloaded');
});

Remove File(s)

remove 'remoteFile', callback
# or, to remove multiple files at once
remove ['remoteFile1', 'remoteFile2'], callback
  • With CoffeeScript
Storage.remove 'from-nosql/test.json', (err) ->
  return console.error err if err
  console.log 'file removed'
  • With JavaScript
Storage.remove('from-nosql/test.json', function(err) {
  if (err) {
    return console.error(err);
  }
  console.log('file removed');
});

Upload File

upload 'localFile', 'remoteFile', callback
# or
upload Buffer, 'remoteFile', callback
  • With CoffeeScript
Storage.upload './uploads/answer.json', 'from-kernel/answer.json', (err) ->
  return console.error err if err
  console.log 'file uploaded'
  • With JavaScript
Storage.upload('./uploads/answer.json', 'from-kernel/answer.json', function(err) {
  if (err) {
    return console.error(err);
  }
  console.log('file uploaded');
});

Options

  • The credentials json should be of the following format:

{
  "accessKeyId": "YOUR_ACCESS_KEY_ID",
  "secretAccessKey": "YOUR_SECRET_ACCESS_KEY",
  "region": "YOUR_REGION"
}

FAQs

Package last updated on 29 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc