mirror of
https://github.com/thangisme/notes.git
synced 2025-11-23 13:12:25 -05:00
Initial commit
This commit is contained in:
20
node_modules/cosmiconfig/lib/readFile.js
generated
vendored
Normal file
20
node_modules/cosmiconfig/lib/readFile.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
module.exports = function (filepath, options) {
|
||||
options = options || {};
|
||||
options.throwNotFound = options.throwNotFound || false;
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
fs.readFile(filepath, 'utf8', function (err, content) {
|
||||
if (err && err.code === 'ENOENT' && !options.throwNotFound) {
|
||||
return resolve(null);
|
||||
}
|
||||
|
||||
if (err) return reject(err);
|
||||
|
||||
resolve(content);
|
||||
});
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user