Skip to content

Commit

Permalink
update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
frankleng committed May 7, 2021
1 parent c56a526 commit 337083b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import DdbCsv from 'dynamocsv';
const service = new DdbCsv({
client: new DynamoDBClient({}),
target: 'dump.csv',
target: 'dump.csv', // (string, WritableStream, async callback)
input: { tableName: 'ddb_test_table', index: 'awesomeness' },
format: 'csv', // (csv | json | object)
query: {
keyCondExpressionMap: {
hash: 'test',
Expand All @@ -26,12 +27,13 @@ await service.exec();

### Args
+ *client* - An instance of DynamoDBClient, example uses aws-sdk 3, but v2 should also work
+ *target* - file name with extension, or an instance of Node.js WriteStream.
+ *target* - file name with extension, or an instance of Node.js WriteStream or async callback. ie. `async (rows) => { const result = await writeToDb(rows); return result.count; }`;
+ *format* - csv (default) | json | object - object requires a writable stream in object mode or use an async callback to capture values.k
+ *input*
+ *tableName* - string (required)
+ *index* - string (optional)
+ *limit* - number (optional, default 2000)
+ *query* - a simplified mapping to generate `KeyConditionExpression` and `FilterExpression`. See example above - key/val pair generates a simple equality condition, use an object to specify operator and value if needed.
+ *keyCondExpressionMap*
+ *filterExpressionMap*
+ *rowPredicate* - (row, context) => row - a function that is called for each row. See example above - use the `context` methods to modify headers as needed.
+ *rowPredicate* - `(row, context) => row` - a function that is called for each row. See example above - use the `context` methods to modify headers as needed.
2 changes: 1 addition & 1 deletion dynamocsv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default class Dynamocsv {
return this.headers;
}

applyRowPredicate = (row: any) => {
private applyRowPredicate = (row: any) => {
return this.rowPredicate ? this.rowPredicate(row, this) : row;
};

Expand Down

0 comments on commit 337083b

Please sign in to comment.