Commit fcbb273f849c3461503eca3ee509e383862f0eea
Replaces exists by access when verifying if path exists
Rômulo Alves committed on 4/6/2018, 3:33:24 PMParent: 9f1a979b7f51f8cee424235f83aec68ba572e50f
Files changed
utils.js | changed |
utils.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | 1 … | const { PassThrough } = require('stream'); |
2 | -const { stat, exists } = require('fs'); | |
2 … | +const { stat, access } = require('fs'); | |
3 | 3 … | const fs = require('fs-extra'); |
4 | 4 … | const { createReadStream, createWriteStream, utimes } = require('fs'); |
5 | 5 … | const { createCipher, createDecipher } = require('crypto'); |
6 | 6 … | const { join } = require('path'); |
@@ -36,9 +36,15 @@ | ||
36 | 36 … | * @return {Promise<Boolean>} Returns a boolean to indicate if path exists |
37 | 37 … | */ |
38 | 38 … | module.exports.exists = path => |
39 | 39 … | new Promise(resolve => { |
40 | - return exists(path, exists => resolve(exists)); | |
40 … | + return access(path, err => { | |
41 … | + if (err) { | |
42 … | + return resolve(false); | |
43 … | + } | |
44 … | + | |
45 … | + return resolve(true); | |
46 … | + }); | |
41 | 47 … | }); |
42 | 48 … | |
43 | 49 … | /** |
44 | 50 … | * @function delete |
Built with git-ssb-web