0.0.9 • Published 6 months ago

fs-write-queue v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

fs-write-queue

fs-write-queue is a simple wrapper around node's fs package that provides transactional writing of files.

This is done by writing all files to ./.tmp and once all are successful, moving them to the proper directories.

To use:

const FW = require('fs-write-queue');
const fileWriter = new FW();

const files = [
    {
    path:'path/to/file',
    filename:'filename',
    data: '<p>Content here</p>'
    }
];

files.forEach(file => fileWriter.add(file.path, file.filename, file.data));

const error = fileWriter.process();

if(error) {
    console.error(error);
    return process.exit(0)
}

console.log('All files written successfully');
process.exit(1);
0.0.9

6 months ago

0.0.8

6 months ago

0.0.7

6 months ago

0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago