How to use the statAsync function from fs
Find comprehensive JavaScript fs.statAsync code examples handpicked from public code repositorys.
GitHub: avinoamr/rotatable
92 93 94 95 96 97 98 99 100 101
// locking the file to prevent paralel writes lockfile.lockAsync(lock, { stale: 10000, wait: 5000 }).then(() => { return fs.statAsync(self.path) }).catch((err) => { // if no entry, file has been moved or removed keep going if (err.code === "ENOENT") { return null // file has been moved or removed. force a re-open.
1
1
0
+ 3 other calls in file
31 32 33 34 35 36 37 38 39 40 41
// Server.js // Returns true if successful or false otherwise async function checkCreateUploadsFolder(uploadsFolder) { try { await fs.statAsync(uploadsFolder); } catch (e) { if (e && e.code == "ENOENT") { console.log("The uploads folder doesn't exist, creating a new one..."); try {
0
0
0
fs.readFileSync is the most popular function in fs (2736 examples)