# s3-commons

> Common helper functions to make using AWS S3 service easier

Latest version **1.0.1** (published 2019-05-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install s3-commons
pnpm add s3-commons
yarn add s3-commons
bun add s3-commons
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-05-16 |
| First published | 2019-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=8.9 |
| Dependencies | 0 |
| Unpacked size | 17.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | bingtimren |

## Links

- npm: https://www.npmjs.com/package/s3-commons
- Repository: https://github.com/bingtimren/s3-commons
- Homepage: https://github.com/bingtimren/s3-commons#readme
- Issues: https://github.com/bingtimren/s3-commons/issues
- npm.io page: https://npm.io/package/s3-commons

## Recent versions

- 1.0.1 (latest) — 2019-05-16
- 1.0.0 — 2019-05-15

## README

# s3-commons

Common helper functions to make using AWS S3 service easier

## Usage

```Javascript
const AWS = require('aws-sdk')
const s3 = new AWS.S3()
const s3c = require('s3-commons')
const count = await s3c.deleteRecursive(
    s3, 
    'your-bucket',
    '/folder/to/empty')
const list = await s3c.deleteRecursiveVerbose(
    s3, 
    'your-bucket',
    '/folder/to/empty')
```

## deleteRecursive & deleteRecursiveVerbose
Both async functions delete objects recursively under a dir (or "prefix" according to S3) and returns a Promise (as all async functions do).

The Promise from deleteRecursive resolves to a number that is count of deleted keys. The Promise from deleteRecursiveVerbose resolves to an array of string that is array of deleted keys

Parameters:
- s3: the S3 service instance
- bucket: string, bucket name
- dir: string, the path prefix

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