Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcollina/fast-write-atomic
Fast way to write a file atomically, for Node.js
https://github.com/mcollina/fast-write-atomic
Last synced: 12 days ago
JSON representation
Fast way to write a file atomically, for Node.js
- Host: GitHub
- URL: https://github.com/mcollina/fast-write-atomic
- Owner: mcollina
- License: mit
- Created: 2018-12-20T13:30:40.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-08T12:15:33.000Z (almost 6 years ago)
- Last Synced: 2024-05-02T01:05:44.609Z (8 months ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 19
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fast-write-atomic
[![Build
Status](https://travis-ci.com/mcollina/fast-write-atomic.svg?branch=master)](https://travis-ci.com/mcollina/fast-write-atomic)Fast way to write a file atomically, for Node.js
Status: *experimental*
## Install
```
npm i fast-write-atomic
```## Example
```js
const writeFile = require('fast-write-atomic')const data = Buffer.from('hello world')
writeFile('./hello', data, function (err) {
if (err) {
console.log(err)
return
}console.log('file written')
})
```## Benchmarks
Those benchmarks writes a 1 MB file a thousand times:
```
benchWriteFileAtomic*1000: 9830.501ms
benchFastWriteAtomic*1000: 8848.916ms
benchWriteFileAtomic*1000: 9944.722ms
benchFastWriteAtomic*1000: 8997.108ms
```## License
MIT