Skip to main content

Deno FastWriter ✒

Fast & Safe file writing for Deno!

This utility has no dependencies, and is made to speed up overwriting the same file. It writes the last provided data only when previous data has been written. Also, the writing is atomic, so main file will not be corrupted in case of an emergency process exiting.

This library is heavily inspired by steno made by typicode. FastWriter uses same optimization techniques, but made specifically for Deno.


Example

import { FastWriter } from 'https://deno.land/x/fastwriter/mod.ts'

// Initialize writer
const writer = new FastWriter('./my-file.txt');

// Write data using this method
writer.write('Super-fast writing!');

Benchmarks

Operations FastWriter writeTextFile writeTextFile (Without await)
1,000 < 1ms 1724ms 12ms
10,000 3ms 26372ms 89ms
100,000 16ms 922ms

You can run benchmark.ts to check it by yourself!


License

MIT (see LICENSE file)