@sgtpooki/steno-patched
TypeScript icon, indicating that this package has built-in type declarations

3.1.1 • Public • Published

THIS IS A FORK

Note that the primary repo can be found at https://github.com/typicode/steno

Steno Node.js CI

Specialized fast async file writer

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

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

Features

  • ⚡ Fast (see benchmark)
  • 🐦 Lightweight (~6kb)
  • 👍 ⚛️ Safe: No partial writes (writes are atomic)
  • 👍 🏁 Safe: No race conditions (writes are ordered even if they're async)

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 (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.

License

MIT - Typicode

Package Sidebar

Install

npm i @sgtpooki/steno-patched

Weekly Downloads

0

Version

3.1.1

License

MIT

Unpacked Size

6.75 kB

Total Files

5

Last publish

Collaborators

  • sgtpooki