Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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 ✒
- Host: GitHub
- URL: https://github.com/kirlovon/fast-writer
- Owner: Kirlovon
- License: mit
- Created: 2021-08-16T00:59:08.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-08-16T01:06:00.000Z (about 3 years ago)
- Last Synced: 2024-09-27T00:19:32.771Z (about 1 month ago)
- Topics: deno, javascript, library, steno, typescript, utility, writing
- Language: TypeScript
- Homepage: https://deno.land/x/fastwriter
- Size: 2.93 KB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)_