# steno

> Specialized fast async file writer

Latest version **4.0.2** (published 2023-12-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install steno
pnpm add steno
yarn add steno
bun add steno
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.0.2 |
| Published | 2023-12-26 |
| First published | 2014-10-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 6.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 690 |
| Author | Typicode |
| Maintainers | typicode |
| Keywords | fs, file, write, writer, asynchronous, fast, race, condition, atomic, writing, safe |

## Links

- npm: https://www.npmjs.com/package/steno
- Repository: https://github.com/typicode/steno
- Issues: https://github.com/typicode/steno/issues
- Funding: https://github.com/sponsors/typicode
- npm.io page: https://npm.io/package/steno

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 4.0.2 (latest) — 2023-12-26
- 4.0.1 — 2023-12-26
- 4.0.0 — 2023-12-26
- 3.2.0 — 2023-12-26
- 3.1.1 — 2023-10-23
- 3.1.0 — 2023-10-07
- 3.0.0 — 2022-10-17
- 2.1.0 — 2021-08-17
- 2.0.0 — 2021-06-06
- 1.0.0 — 2021-03-11
- 0.5.0 — 2020-03-18
- 0.4.4 — 2016-03-09
- 0.4.3 — 2016-02-13
- 0.4.2 — 2015-06-25
- 0.4.1 — 2015-06-02
- … 9 more at https://npm.io/package/steno/versions

## README

# Steno [![](http://img.shields.io/npm/dm/steno.svg?style=flat)](https://www.npmjs.org/package/steno) [![Node.js CI](https://github.com/typicode/steno/actions/workflows/node.js.yml/badge.svg)](https://github.com/typicode/steno/actions/workflows/node.js.yml)

> Specialized fast async file writer

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

Used in [lowdb](https://github.com/typicode/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

```javascript
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](https://github.com/typicode)

---
_Source: https://npm.io/package/steno · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
