Super fast async file writer with atomic write
Steno makes writing concurrently fast and safe.
Battle-tested in lowdb.
import { Writer } from 'steno'
// Create a singleton writer
const file = new Writer('file.txt')
// Use it in the rest of your code
async function save() {
await file.write('some data')
}
npm run benchmark
(see src/benchmark.ts
)
Write 1KB data to the same file x 1000
fs : 62ms
steno : 1ms
Write 1MB data to the same file x 1000
fs : 2300ms
steno : 5ms
Steno uses a smart queue and avoids unnecessary writes.
https://en.wikipedia.org/wiki/Stenotype
MIT - Typicode