git ssb

0+

Rômulo Alves / sync



Commit fcbb273f849c3461503eca3ee509e383862f0eea

Replaces exists by access when verifying if path exists

Rômulo Alves committed on 4/6/2018, 3:33:24 PM
Parent: 9f1a979b7f51f8cee424235f83aec68ba572e50f

Files changed

utils.jschanged
utils.jsView
@@ -1,6 +1,6 @@
11 const { PassThrough } = require('stream');
2-const { stat, exists } = require('fs');
2 +const { stat, access } = require('fs');
33 const fs = require('fs-extra');
44 const { createReadStream, createWriteStream, utimes } = require('fs');
55 const { createCipher, createDecipher } = require('crypto');
66 const { join } = require('path');
@@ -36,9 +36,15 @@
3636 * @return {Promise<Boolean>} Returns a boolean to indicate if path exists
3737 */
3838 module.exports.exists = path =>
3939 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 + });
4147 });
4248
4349 /**
4450 * @function delete

Built with git-ssb-web