You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import {createWriteStream} from 'node:fs';
import { Transform } from '@json2csv/node';
import {Readable} from "node:stream";
(async () => {
const input = new Readable({
read() {},});
const transform = new Transform();
const output = createWriteStream('test.csv', { encoding: 'utf8' });
input.pipe(transform).pipe(output);
input.push(JSON.stringify({a: 1}))
input.push(JSON.stringify({a: 2}))
})();
The error is
Error [ERR_STREAM_WRITE_AFTER_END]: write after end
at _write (node:internal/streams/writable:481:11)
at Writable.write (node:internal/streams/writable:502:10)
at Readable.ondata (node:internal/streams/readable:1007:22)
at Readable.emit (node:events:519:28)
at Readable.read (node:internal/streams/readable:780:10)
at flow (node:internal/streams/readable:1281:53)
at resume_ (node:internal/streams/readable:1260:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on JSON2CSVNodeTransform instance at:
at emitErrorNT (node:internal/streams/destroy:169:8)
at emitErrorCloseNT (node:internal/streams/destroy:128:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'ERR_STREAM_WRITE_AFTER_END'
}
Why I need multiple write? So, I would like to export AWS DynamoDB records into CSV. When I read records, AWS DynamoDB provide array of items and nextToken to continue read. To read all DynamoDB records I need multiple request untile DynamoDB record return nextToken = null
The text was updated successfully, but these errors were encountered:
I have an issue when I try to transform JSON into CSV records multiple times.
Package version: 7.0.6
Node version: v20.15.1
Whole code:
The error is
Why I need multiple write? So, I would like to export AWS DynamoDB records into CSV. When I read records, AWS DynamoDB provide array of items and nextToken to continue read. To read all DynamoDB records I need multiple request untile DynamoDB record return nextToken = null
The text was updated successfully, but these errors were encountered: