Read a file, then remove it
npm install read-remove-file



Read a file, then remove it
``javascript
const readRemoveFile = require('read-remove-file');
readRemoveFile('path/to/file').then(buf => {
buf; //=>
fs.accessSync('path/to/file'); // Error: ENOENT
});
`
``
npm install read-remove-file
`javascript`
const readRemoveFile = require('read-remove-file');
filePath: String Object
options: or String ([fs.readFile][fs.readFile] options) Promise
Return:
It [reads a file][fs.readFile], removes the file and returns a promise of the file contents.
`javascript``
readRemoveFile('path/to/file', 'utf8').then(str => {
str; //=> 'file contents'
fs.accessSync('path/to/file'); // Error: ENOENT
});
ISC License © 2018 Shinnosuke Watanabe
[fs.readFile]: https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback