# @redchili/steno

> Specialized fast async file writer

Latest version **2.0.1** (published 2021-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install @redchili/steno
pnpm add @redchili/steno
yarn add @redchili/steno
bun add @redchili/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 | 2.0.1 |
| Published | 2021-08-22 |
| First published | 2021-08-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 11.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ben |
| Maintainers | redchili |
| Keywords | fs, file, write, writer, asynchronous, fast, race, condition, atomic, writing, safe |

## Links

- npm: https://www.npmjs.com/package/@redchili/steno
- Repository: https://github.com/xiamu14/steno
- Issues: https://github.com/xiamu14/steno/issues
- npm.io page: https://npm.io/package/@redchili/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

- 2.0.1 (latest) — 2021-08-22

## 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)
- Promise-based
- Atomic write
- No race condition
- TypeScript definitions

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

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