Loading page…
Loading page…
Node.js use case
Feed a Node read stream to Diakrio and await the output stream's drain event. This keeps input, conversion, and disk throughput synchronized.
@diakrio/converterThis scoped package has no verified public npm release as of 2026-09-18. You can try the locally built runtime on this site while the release is prepared.
The existing public package is convert-buddy-js 1.0.4. Its MIT license and API belong to that version; the scoped v2 examples target the published beta.
Free for personal and commercial application use. License and notices.
import { createReadStream, createWriteStream } from 'node:fs';
import { once } from 'node:events';
import { ConvertBuddy } from '@diakrio/converter';
const input = createReadStream('events.csv');
const output = createWriteStream('events.ndjson');
const controller = new ConvertBuddy({ profile: true }).stream(input, {
inputFormat: 'csv',
outputFormat: 'ndjson',
onBytes: async (chunk) => {
if (!output.write(chunk)) await once(output, 'drain');
}
});
try {
const stats = await controller.done;
output.end();
await once(output, 'finish');
console.table({
mbPerSecond: stats.wallThroughputMbPerSec.toFixed(2),
recordsPerSecond: Math.round(stats.recordsPerSec),
records: stats.recordsOut,
peakEngineBufferMiB: (stats.maxBufferSize / 2 ** 20).toFixed(2),
processRssMiB: (process.memoryUsage().rss / 2 ** 20).toFixed(2)
});
} catch (error) {
output.destroy();
throw error;
}After the scoped package is released, save as convert.mjs, then run node convert.mjs.
Diakrio reports engine timings and its peak partial-record buffer. Node'sprocess.memoryUsage() reports process-wide runtime memory. Keep both numbers: they answer different questions and make benchmark claims reproducible.