dynamodb-read-stream
TypeScript icon, indicating that this package has built-in type declarations

1.0.11 • Public • Published

dynamodb-read-stream

An open-source tool for reading data chunk by chunk. This tool is created for handling DynamoDB limitation for one response (1 MB). This library provides read stream implementation for DynamoDB.

npm

Example usage

Query reader

const reader = new DocumentClientQueryReadable(
  new DocumentClient(), {
  TableName: 'someTable',
  KeyConditionExpression: 'key = :primaryKey',
  ExpressionAttributeValues: {
    ':primaryKey': 'someValue'
  }
})
const transformOutput = new Transform({
  objectMode: true,
  transform (chunk: DocumentClient.QueryOutput, encoding: string, callback: (error?: Error, data?: any) => void): void {
    callback(undefined, JSON.stringify(chunk) + '\n')
  }
})

reader
  .pipe(transformOutput)
  .pipe(process.stdout)

Scan reader

const client = new DocumentClient()
const reader = new DocumentClientScanReadable(client, {
  TableName: 'someTable'
});
const transformOutput = new Transform({
  objectMode: true,
  transform (chunk: DocumentClient.ScanOutput, encoding: string, callback: (error?: Error, data?: any) => void): void {
    callback(undefined, JSON.stringify(chunk) + '\n')
  }
})

reader
  .pipe(transformOutput)
  .pipe(process.stdout)

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i dynamodb-read-stream

    Weekly Downloads

    47

    Version

    1.0.11

    License

    Apache-2.0

    Unpacked Size

    25.2 kB

    Total Files

    33

    Last publish

    Collaborators

    • alexgladin