Nocturnal Practitioners of Magic
    Wondering what’s next for npm?Check out our public roadmap! »

    steno
    TypeScript icon, indicating that this package has built-in type declarations

    2.0.0 • Public • Published

    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 (see src/benchmark.ts)

    Write 1KB data to the same file x 1000
    
      fs     : 62.303ms
      steno  : 1.384ms
    
      fs.txt = steno.txt ✓
    
    
    Write 1MB data to the same file x 1000
    
      fs     : 2.300s
      steno  : 5.444ms
    
      fs.txt = steno.txt ✓
    

    License

    MIT - Typicode

    Install

    npm i steno

    DownloadsWeekly Downloads

    320,123

    Version

    2.0.0

    License

    MIT

    Unpacked Size

    7.34 kB

    Total Files

    5

    Last publish

    Collaborators

    • avatar