How to use the unlinkAsync function from fs
Find comprehensive JavaScript fs.unlinkAsync code examples handpicked from public code repositorys.
25 26 27 28 29 30 31 32 33 34
// If a dump exists, uncompress it & use it as a starting point var dumpPromise = P.resolve(); if (fs.existsSync(dumpDB)) { dumpPromise = proc.execFileAsync('pixz', ['-d', dumpDB, workDB]) .catch(function() { return fs.unlinkAsync(workDB); }); } return dumpPromise
6
5
26
+ 3 other calls in file
GitHub: avinoamr/rotatable
286 287 288 289 290 291 292 293 294 295
/** * @private */ function _unlink(path, stream) { stream.emit('delete', path) return fs.unlinkAsync(path) .catch((err) => { // if no entry, file has been moved or removed - keep going if (err.code !== 'ENOENT') { throw err
1
1
0
95 96 97 98 99 100 101 102 103 104
try { await fs.renameAsync(file.path, join(uploadsFolder, fileName)); } catch (e) { console.log("Error uploading the file"); try { await fs.unlinkAsync(file.path); } catch (e) {} return res.json({ ok: false, msg: "Error uploading the file" }); } } else {
0
0
0
fs.readFileSync is the most popular function in fs (2736 examples)