Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kirlovon/fast-writer

Fast & Safe file writing for Deno ✒
https://github.com/kirlovon/fast-writer

deno javascript library steno typescript utility writing

Last synced: 26 days ago
JSON representation

Fast & Safe file writing for Deno ✒

Awesome Lists containing this project

README

        

# Deno FastWriter ✒
Fast & Safe file writing for [Deno](https://deno.land/)!

This utility has no dependencies, and is made to speed up overwriting the same file. It writes the last provided data only when previous data has been written. Also, the writing is **atomic**, so main file will not be corrupted in case of an emergency process exiting.

> This library is heavily inspired by [steno](https://github.com/typicode/steno) made by [typicode](https://github.com/typicode). FastWriter uses same optimization techniques, but made specifically for Deno.


## Example
```typescript
import { FastWriter } from 'https://deno.land/x/fastwriter/mod.ts'

// Initialize writer
const writer = new FastWriter('./my-file.txt');

// Write data using this method
writer.write('Super-fast writing!');
```


## Benchmarks
| Operations | FastWriter | writeTextFile | writeTextFile _(Without `await`)_ |
| ---------- | ------------ | ------------- | ------------------------------- |
| 1,000 | **< 1ms** | 1724ms | 12ms |
| 10,000 | **3ms** | 26372ms | 89ms |
| 100,000 | **16ms** | ∞ | 922ms |

_You can run `benchmark.ts` to check it by yourself!_


## License
MIT _(see [LICENSE](https://github.com/Kirlovon/FastWriter/blob/master/LICENSE) file)_