Designed to be a drop and replace for fs.writeFile and fs.mkdir. It supports recursive directory creation. It contains zero dependencies and uses Promises.
npm install fsl-asyncNode.js: fsl-async
=================
Installation
------------
npm install --save fsl-async
Usage
-----
fsl-async contains drop in replacements for fs.writeFile and fs.mkdir. If the path you specify doesn't exist, it will create it. It doesn't contain any dependencies. Uses Promises.
``js`
const fsl = require('fsl-async');
`js`
fsl.mkdir('/tmp/dir/does/not/exist/yet').then(() => {
console.log('Done.');
});
The second argument sets a mode and follows the same rules as fs.mkdir.
`js`
fsl.mkdir('/tmp/dir/does/not/exist/yet', 0o664).then(() => {
console.log('Done.');
});
`js`
fsl.writeFile('/tmp/dir/does/not/exist/yet/myfile', 'hello world').then(() => {
console.log('Done.');
});
Supports fs.writeFile options as its third argument.
`js`
fsl.writeFile('/tmp/dir/does/not/exist/yet/myfile', 'hello world', 'utf8').then(() => {
console.log('Done.');
});
OR
`js``
fsl.writeFile('/tmp/dir/does/not/exist/yet/myfile', 'hello world', { encoding: 'utf8' }).then(() => {
console.log('Done.');
});