JSPM

fast-write-atomic

0.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 115448
  • Score
    100M100P100Q164060F
  • License MIT

Fast way to write a file atomically, for Node.js

Package Exports

  • fast-write-atomic

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fast-write-atomic) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fast-write-atomic

Build
Status

Fast way to write a file atomically, for Node.js

Status: experimental

Install

npm i fast-write-atomic

Example

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