Socket
Socket
Sign inDemoInstall

steno

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    steno

Specialized fast async file writer


Version published
Weekly downloads
645K
decreased by-0.27%
Maintainers
1
Install size
6.92 kB
Created
Weekly downloads
 

Readme

Source

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)
  • 👍 ⚛️ 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

Keywords

FAQs

Last updated on 26 Dec 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc