# dynamo-batchwrite-queue

> An Async Queue for dispatching DynamoDB batchWrite.

Latest version **1.0.1** (published 2016-04-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install dynamo-batchwrite-queue
pnpm add dynamo-batchwrite-queue
yarn add dynamo-batchwrite-queue
bun add dynamo-batchwrite-queue
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-04-16 |
| First published | 2016-04-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.3.2 |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Adios Tsai |
| Maintainers | adios |
| Keywords | dynamo, dynamodb, batchwrite, queue |

## Links

- npm: https://www.npmjs.com/package/dynamo-batchwrite-queue
- Repository: https://github.com/Adios/dynamo-batchwrite-queue
- Homepage: https://github.com/Adios/dynamo-batchwrite-queue#readme
- Issues: https://github.com/Adios/dynamo-batchwrite-queue/issues
- npm.io page: https://npm.io/package/dynamo-batchwrite-queue

## Dependencies (2)

- [async](https://npm.io/package/async.md) ^2.0.0-rc.3
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.3.3

## Alternatives

- [cron](https://npm.io/package/cron.md) — 4.9M weekly downloads
- [@vercel/queue](https://npm.io/package/@vercel/queue.md) — 731.6K weekly downloads
- [create-sonicjs](https://npm.io/package/create-sonicjs.md) — 1.6K weekly downloads
- [@exellix/jobs-api](https://npm.io/package/@exellix/jobs-api.md) — 941 weekly downloads
- [@forwardimpact/libskill](https://npm.io/package/@forwardimpact/libskill.md) — 575 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-04-16
- 1.0.0 — 2016-04-16

## README

# dynamo-batchwrite-queue

A simple implementation for queuing up `DynamoDB.DocumentClient.batchWrite()` in `async.queue()`.

Also implements an endless exponential retry when encounter `ProvisionedThroughtput` error.

## Requirements

I didn't use `babel`, so it needs at least `node 4.3.2` as there are some ES2015 syntax inside.

## Installation

`npm install dynamo-batchwrite-queue`

## Usage

    const queue = require('dynamo-batchwrite-queue')

    // all the same, defaults to concurrency=2.
    var qdb = queue()
    var qdb = queue(2)
    var qdb = queue(document_client_options, 2)

    // you can also put your DocumentClient instance.
    var qdb = queue(new aws.DynamoDB.DocumentClient(options), 10)

    // assume done() is the callback for your node handler.
    qdb.drain = () => done()

    // params: see DynamoDB.DocumentClient.batchWrite()
    qdb.push(params)

    // records: array of DocumentDB params to be inserted into dynamodb
    let buf = [], i = 0
    records.forEach(v => {
        i++
	buf.push(v)

        // batchWrite supports at most 25 once a time.
	if (buf.length >= 25) {
            qdb.push(buf)
	    buf = []
	    i = 0
	}
    })
    if (buf.length) qdb.push(buf)

## License

ISC

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