@house-agency/profs
v1.0.0
Published
Promise-versions of filesystem functions
Downloads
2
Keywords
Readme
profs - Promisified Filesystem Functions
Installation
npm install profs --save-dev
Usage
const fs = require('profs');
fs.copy('path/to/source', 'path/to/target')
.catch((e) => { console.warn(e) })
.then(() => { console.log('Copy successful!') })
Functions
copy(source, target) → {Promise}
Copy file or a directory and all its content. Uses ncp.
__ Example __
fs.copy('path/to/source', 'path/to/target')
delete(path) → {Promise}
Delete file.
__ Example __
fs.delete('path/to/file')
mkdir(path) → {Promise}
Create directories. Will create all directories that doesn't exist. Uses mkdirp.
__ Example __
fs.mkdir('path/to/dir')
read(path) → {Promise}
Read a file.
__ Example __
fs.read('path/to/file')
rmdir(path) → {Promise}
Delete a directory and all its content. Uses rmdir.
__ Example __
fs.rmdir('path/to/dir')
stat(path) → {Promise}
Get file or directory status. Can be used to see if something exists.
__ Example __
fs.stat('path/to/something')
.catch((e) => { console.log('Does not exist')})
.then((data) => { console.log('Does exist:', data) })
write(path, content) → {Promise}
Write file content.
__ Example __
fs.write('path/to/file', 'file content')