How to use the exists function from fs
Find comprehensive JavaScript fs.exists code examples handpicked from public code repositorys.
102 103 104 105 106 107 108 109 110 111
name = `${name}`; return new IAsyncOperation((res, rej) => { this.ensureInitialised().then(_ => { var filePath = _path.join(this.path, name); fs.exists(filePath, (exists: boolean) => { if (exists) { if (collision == CreationCollisionOption.failIfExists) { rej(); return;
1
12
3
+ 7 other calls in file
110 111 112 113 114 115 116 117 118 119
async.waterfall([ async.apply(HelperFS.createFolderIfNotExists, cmsfiles_folder), async.apply(HelperFS.clearFiles, public_folder, jsh.Config.public_temp_expiration, -1), function (callback) { fs.exists(cmsfiles_folder + file_orig_name, function (exists) { if (exists) return callback({ number: -37, message: 'File already exists' }); else return callback(null); }); },
5
5
2
69 70 71 72 73 74 75 76 77 78
"frontend", "build/images", name + ".jpg" ); //CHECK EXISTING IMG Fs.exists(path, function (exists) { if (!exists) { return downloadImage(userPic, name); } });
0
0
1
+ 2 other calls in file
GitHub: a-labo/asfs
16 17 18 19 20 21 22 23 24 25
* @param {string} filename * @returns {Promise.<boolean>} */ async existsAsync(filename) { return new Promise((resolve) => fs.exists(filename, (exists) => resolve(exists)) ) }, /**
0
0
2
fs.readFileSync is the most popular function in fs (2736 examples)