our simplified wrapper for common AWS S3 operations


0192.2.04 years ago6 years agoMinified + gzip package size for @blinkmobile/aws-s3 in KB


blinkmobile/aws-s3 npm module Build Status Greenkeeper badge AppVeyor Status

our simplified wrapper for common AWS S3 operations

Getting Started

npm install @blinkmobile/aws-s3 aws-sdk
const upload = require('@blinkmobile/aws-s3').upload;
const AWS = require('aws-sdk');


AWS SDK for Javascript, version >= v2.3.9


const task = upload({
  // common options
  cwd: '', // current working directory to search, defaults to `process.cwd()`
  prune: false, // true => delete S3 Objects that don't match local files
  s3: new AWS.S3({ /* ... */ }),

  // advanced options
  dryRun: false, // true bypasses write calls with simulated success events
  filePaths: [''], // paths relative to rootPath, defaults to glob(['**/*'])
  fs: null, // defaults to `require('fs')`
  bucketPathPrefix: '' // upload objects to base path in S3 bucket

const EventEmitter = require('events');
console.assert(task instanceof EventEmitter);
console.assert(task.promise instanceof Promise);


We ignore certain files and directories by default.

The "cwd" directory may also contain a ".blinkmignore" file. This file is like a .gitignore file.

This file should contain globs, which we combine with the above defaults for the "ignore" option for glob.


# we ignore comments and empty lines



upload (options: UploadOptions) => Task
interface Task extends EventEmitter {
  filePaths: String[],
  files: Map,
  objects: Map,
  promise: Promise

Note: until task.promise resolves / rejects, other properties may not be available. EventEmitter methods are always available.

interface UploadOptions {
  cwd? : String, // defaults to process.cwd()
  dryRun = false: Boolean,
  filePaths?: String[], // defaults to glob(['**/*'])
  fs? : Object, // defaults to require('fs')
  prune = false : Boolean,
  s3: AWS.S3,
  skip = true : Boolean,
  bucketPathPrefix?: String // defaults to ''


  • skipped: fileName

  • uploading: fileName

  • uploaded: fileName

  • error: error, fileName

  • deleting: fileName

  • deleted: fileName

const task = upload({ /* ... */ });
task.on('error', (error, fileName) => {
  // TODO: ...


  • "dryRun" option
  • "fs" option

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.