# @blinkmobile/aws-s3

> our simplified wrapper for common AWS S3 operations

Latest version **2.2.0** (published 2017-05-18) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @blinkmobile/aws-s3
pnpm add @blinkmobile/aws-s3
yarn add @blinkmobile/aws-s3
bun add @blinkmobile/aws-s3
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2017-05-18 |
| First published | 2016-03-03 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 9 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ron Waldon |
| Maintainers | blinkmobile-admin, k7n4n5t3w4rt, simon_marklar |

## Links

- npm: https://www.npmjs.com/package/@blinkmobile/aws-s3
- Repository: https://github.com/blinkmobile/aws-s3.js
- Homepage: https://github.com/blinkmobile/aws-s3.js#readme
- Issues: https://github.com/blinkmobile/aws-s3.js/issues
- npm.io page: https://npm.io/package/@blinkmobile/aws-s3

## Dependencies (9)

- [co](https://npm.io/package/co.md) ^4.6.0
- [glob](https://npm.io/package/glob.md) ^7.0.3
- [pify](https://npm.io/package/pify.md) ^2.3.0
- [file-type](https://npm.io/package/file-type.md) ^4.0.0
- [mime-types](https://npm.io/package/mime-types.md) ^2.1.10
- [read-chunk](https://npm.io/package/read-chunk.md) ^2.0.0
- [worker-farm](https://npm.io/package/worker-farm.md) ^1.3.1
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) ^4.0.6
- [ignore-by-default](https://npm.io/package/ignore-by-default.md) ^1.0.1

## Recent versions

- 2.2.0 (latest) — 2017-05-18
- 2.1.0 — 2016-10-31
- 2.0.0 — 2016-06-08
- 1.2.0 — 2016-04-04
- 1.1.1 — 2016-03-03
- 1.1.0 — 2016-03-03
- 1.0.1 — 2016-03-03
- 1.0.0 — 2016-03-03

## README

# blinkmobile/aws-s3 [![npm module](https://img.shields.io/npm/v/@blinkmobile/aws-s3.svg)](https://www.npmjs.com/package/@blinkmobile/aws-s3) [![Build Status](https://travis-ci.org/blinkmobile/aws-s3.js.svg?branch=master)](https://travis-ci.org/blinkmobile/aws-s3.js) [![Greenkeeper badge](https://badges.greenkeeper.io/blinkmobile/aws-s3.js.svg)](https://greenkeeper.io/) [![AppVeyor Status](https://img.shields.io/appveyor/ci/blinkmobile/aws-s3-js/master.svg)](https://ci.appveyor.com/project/blinkmobile/aws-s3-js)

our simplified wrapper for common AWS S3 operations

## Getting Started

```sh
npm install @blinkmobile/aws-s3 aws-sdk
```

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


## Requirements

AWS SDK for Javascript, version >= v2.3.9


## Usage

```js
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);
```


### .blinkmignore

We ignore certain files and directories [by default](https://github.com/novemberborn/ignore-by-default).

The "cwd" directory may also contain a ".blinkmignore" file.
This file is like a [.gitignore](https://git-scm.com/docs/gitignore) file.

This file should contain [globs](https://www.npmjs.com/package/glob#glob-primer),
which we combine with the above defaults for the ["ignore" option for `glob`](https://www.npmjs.com/package/glob#options).

Example:

```
# we ignore comments and empty lines

do-not-upload/**/anything-in-this-directory/**/*
or-this-file.txt
```


## API

```
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 ''
}
```


### Events

- **skipped**: `fileName`

- **uploading**: `fileName`

- **uploaded**: `fileName`

- **error**: `error`, `fileName`

- **deleting**: `fileName`

- **deleted**: `fileName`

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


## Roadmap

- [ ] "dryRun" option
- [ ] "fs" option

---
_Source: https://npm.io/package/@blinkmobile/aws-s3 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
