Loading page…
Loading page…
Browser use case
The File System Access API lets Chromium-based browsers persist each output chunk as it arrives. Diakrio awaits every write, so a slower disk applies backpressure to the converter instead of growing an output queue.
The runnable harness uses the same local streaming path and discards output after a small preview, so you can measure it without opening a save dialog.
10,000 generated CSV records
import { ConvertBuddy, getSuggestedFilename } from '@diakrio/converter/browser';
const [fileHandle] = await window.showOpenFilePicker();
const input = await fileHandle.getFile();
const output = await window.showSaveFilePicker({
suggestedName: getSuggestedFilename(input.name, 'ndjson')
});
const writable = await output.createWritable();
try {
const controller = new ConvertBuddy({ profile: true }).stream(input, {
inputFormat: 'csv',
outputFormat: 'ndjson',
onBytes: (chunk) => writable.write(chunk)
});
const stats = await controller.done;
await writable.close();
console.table(stats);
} catch (error) {
await writable.abort(error);
throw error;
}End-to-end
0.0 MB/s
Records/sec
0
Records
0
Duration
0 ms
Engine peak buffer
0 B
Runtime heap
Unavailable
Input
0 B
Output
0 B
Engine buffer is exact. Runtime heap is shown only when the runtime exposes a measurement API. Engine-only throughput: 0.0 MB/s.
showSaveFilePicker is not available in every browser. Feature-detect it and either use a bounded in-memory Blob for modest files or ask the user to switch to a supported browser. Diakrio cannot make an in-memory destination constant-memory.
if ('showSaveFilePicker' in window) {
// stream to FileSystemWritableFileStream
} else if (file.size <= 256 * 1024 * 1024) {
// collect output chunks, then download a Blob
} else {
// explain that direct file saving is required
}maxBufferSize is the exact peak partial-record buffer reported by the engine.