Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/AlexHladin/dynamodb-read-stream
Read stream implementation for DynamoDB
https://github.com/AlexHladin/dynamodb-read-stream
Last synced: 2 months ago
JSON representation
Read stream implementation for DynamoDB
- Host: GitHub
- URL: https://github.com/AlexHladin/dynamodb-read-stream
- Owner: AlexHladin
- License: apache-2.0
- Created: 2019-10-03T15:40:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-08-03T03:23:53.000Z (over 3 years ago)
- Last Synced: 2024-09-23T16:08:55.817Z (3 months ago)
- Language: TypeScript
- Size: 32.2 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-dynamodb - DynamoDB Read Stream - source tool for reading data chunk by chunk. This tool is created for handling DynamoDB limitation for one response (1 MB). (Tools)
README
# 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](https://img.shields.io/npm/v/dynamodb-read-stream.svg?style=flat-square)](https://www.npmjs.com/package/dynamodb-read-stream)
## Example usage
### Query reader
```typescript
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
```typescript
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)
```