How to use the exists function from fs-promise
Find comprehensive JavaScript fs-promise.exists code examples handpicked from public code repositorys.
51 52 53 54 55 56 57 58 59 60
* Create an upload directory where specified by Escher.uploadDir * unless it already exists * */ async createUploadDirectory() { const directoryExists = await fs.exists(this.uploadDir); if (!directoryExists) { await fs.mkdir(this.uploadDir); } }
20
26
0
+ 3 other calls in file
GitHub: salil-gtm/SyndiShare
117 118 119 120 121 122 123 124 125 126
const archivePath = path.join(fileDir, ".swarm_downloads/files.tar.gz"); const archiveDir = path.dirname(archivePath); const promise = Q.resolve(mkdirp(archiveDir)) .then(() => checksum (fileHash) (filePath)) .then(() => filePath) .catch(() => fsp.exists(archiveDir) .then(exists => !exists ? fsp.mkdir(archiveDir) : null) .then(() => download (url)(archivePath).onData(promise.onDataCallback)) .then(() => hash("md5")(archivePath)) .then(() => archiveHash ? checksum(archiveHash)(archivePath) : null)
7
12
0
+ 3 other calls in file
GitHub: salil-gtm/SyndiShare
162 163 164 165 166 167 168 169 170 171
var promise = Q.resolve(mkdirp(archiveDir)).then(function () { return checksum(fileHash)(filePath); }).then(function () { return filePath; }).catch(function () { return fsp.exists(archiveDir).then(function (exists) { return !exists ? fsp.mkdir(archiveDir) : null; }).then(function () { return download(url)(archivePath).onData(promise.onDataCallback); }).then(function () {
7
12
0
+ 3 other calls in file
138 139 140 141 142 143 144 145 146 147
width: 500, height: 500, ignoreAspectRatio: true, }) .then(processedImage => { return fp.exists(filePath) }) .then(exists => { if(exists){ // Upload the file to Google Cloud Storage
0
1
2
+ 665 other calls in file
35 36 37 38 39 40 41 42 43 44
// construct path to offline file matching this request var filename = path.resolve(path.join(resourcePath, nodeEnv, req.method, requestPath + extension)).toLowerCase(); // check if the file exists, if so return it, otherwise 404 fs.exists(filename).then(function (exists) { if (exists) { res.sendFile(filename); }
0
0
2
+ 7 other calls in file
GitHub: zhangyuxi/hooks-demo
97 98 99 100 101 102 103 104 105 106
return exec(cmd); } else if (releaseType == 'all' || releaseType == 'c') { console.log('\t copy!'); const modulesPath = `${basePath}node_modules`; return fs.exists(modulesPath).then((exists) => { if (exists) { if (releaseType == 'all') { return fs.copy(modulesPath, `${outputPath}/node_modules`); }
0
0
0
+ 19 other calls in file
fs-promise.writeJson is the most popular function in fs-promise (6458 examples)