Git Product home page Git Product logo

steno's Introduction

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

steno's People

Contributors

fritx avatar kiprasmel avatar luckydrq avatar pi0 avatar thrashr888 avatar tonluong avatar typicode avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.