diff --git a/README.md b/README.md index 343fb38..8db75eb 100644 --- a/README.md +++ b/README.md @@ -12,11 +12,11 @@ This software is governed by the Apache 2.0 license. typically, to use you'd run: - node dynamoDBtoCSV.js -t Hourly_ZEDO_Impressions_by_IP > output.csv + node dynamoDBtoCSV.js -v "{}" -t Hourly_ZEDO_Impressions_by_IP > output.csv or even: - node dynamoDBtoCSV.js -t Hourly_ZEDO_Impressions_by_IP -f output.csv + node dynamoDBtoCSV.js -v "{}" -t Hourly_ZEDO_Impressions_by_IP -f output.csv to export to CSV diff --git a/dynamoDBtoCSV.js b/dynamoDBtoCSV.js index 38ef6d0..ada01a7 100644 --- a/dynamoDBtoCSV.js +++ b/dynamoDBtoCSV.js @@ -217,8 +217,14 @@ const unparseData = (lastEvaluatedKey) => { }); if (writeCount > 0) { // remove column names after first write chunk. - endData = endData.replace(/(.*\r\n)/, "");; + endData = endData.replace(/(.*\r\n)/, ""); } + + // ensure each chunk ends with a newline so next chunk doesn't glue to it + if (!endData.endsWith("\n")) { + endData += "\n"; + } + if (program.file) { writeData(endData); } else { diff --git a/package.json b/package.json index 85d3e7d..954ca6d 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "aws-sdk": ">=2.0.0-rc13", - "commander": ">=2.2.0", + "commander": "6.*", "dynamodb-marshaler": "^2.0.0", "papaparse": "^5.3.0" }