Skip to content
main
Switch branches/tags
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
Mar 11, 2021
src
Mar 11, 2021
Mar 11, 2021
Mar 12, 2021
Mar 11, 2021
Mar 11, 2021

README.md

Steno Node.js CI

Specialized fast async file writer

Steno makes writing to the same file often/concurrently fast and safe.

Used in lowdb.

https://en.wikipedia.org/wiki/Stenotype

Features

  • Fast (see benchmark)
  • Lightweight (~6kb)
  • Promise-based
  • Atomic write
  • No race condition
  • TypeScript definitions

Usage

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')
}

Benchmark

npm run benchmark

Write 1KB data to the same file x 1000
  fs   : 68.464ms
  steno: 0.578ms

Write 1MB data to the same file x 1000
  fs   : 2.166s
  steno: 1.153ms

License

MIT - Typicode