mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
22 lines
384 B
JavaScript
22 lines
384 B
JavaScript
'use strict';
|
|
var fs = require('fs')
|
|
|
|
module.exports = function (pth, cb) {
|
|
var fn = typeof fs.access === 'function' ? fs.access : fs.stat;
|
|
|
|
fn(pth, function (err) {
|
|
cb(null, !err);
|
|
});
|
|
};
|
|
|
|
module.exports.sync = function (pth) {
|
|
var fn = typeof fs.accessSync === 'function' ? fs.accessSync : fs.statSync;
|
|
|
|
try {
|
|
fn(pth);
|
|
return true;
|
|
} catch (err) {
|
|
return false;
|
|
}
|
|
};
|