ssb-ngi-pointer
to demonstrate the outcome of the work done by the SSB NGI Pointer team during 2020 and 2021. The SSB NGI Pointer team is no longer active because we completed our grant project.
This module is meant as a replacement for atomic-file as it has better error handling on node and is faster in the browser.
The library is written to handle writing to a few number of files in a
safe manner. Concurrent writes to the same file are completed in the
order they are started. A temporary file with the same filename as the
original — with a suffix ~
— is employed to ensure atomicity.
Write a buffer to file and read it again:
const atomic = require('atomic-file-rw')
atomic.writeFile("test.txt", Buffer.from('GREETINGS'), (err, x) => {
atomic.readFile("test.txt", (err, buf) => {
console.log(buf.toString())
})
})
Same arguments as Node.js's fs.readFile
, but in the browser the
options
is ignored.
Same arguments as Node.js's fs.writeFile
, but in the browser the
options
is ignored.
Same arguments as Node.js's fs.unlink
.