Comparing version 2.0.0 to 2.1.0
27
index.js
@@ -242,2 +242,27 @@ /* global Bare */ | ||
function exists (filepath, cb) { | ||
if (typeof filepath !== 'string') { | ||
throw typeError('ERR_INVALID_ARG_TYPE', 'Path must be a string. Received type ' + (typeof filepath) + ' (' + filepath + ')') | ||
} | ||
if (typeof cb !== 'function') { | ||
throw typeError('ERR_INVALID_ARG_TYPE', 'Callback must be a function. Received type ' + (typeof cb) + ' (' + cb + ')') | ||
} | ||
return access(filepath, (err) => cb(!!err)) // eslint-disable-line n/no-callback-literal | ||
} | ||
function existsSync (filepath) { | ||
if (typeof filepath !== 'string') { | ||
throw typeError('ERR_INVALID_ARG_TYPE', 'Path must be a string. Received type ' + (typeof filepath) + ' (' + filepath + ')') | ||
} | ||
try { | ||
accessSync(filepath) | ||
return true | ||
} catch { | ||
return false | ||
} | ||
} | ||
function read (fd, buffer, offset, len, pos, cb) { | ||
@@ -1746,2 +1771,3 @@ if (typeof fd !== 'number') { | ||
exports.close = close | ||
exports.exists = exists | ||
exports.fchmod = fchmod | ||
@@ -1774,2 +1800,3 @@ exports.fstat = fstat | ||
exports.closeSync = closeSync | ||
exports.existsSync = existsSync | ||
exports.fchmodSync = fchmodSync | ||
@@ -1776,0 +1803,0 @@ exports.fstatSync = fstatSync |
{ | ||
"name": "bare-fs", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Native file system for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,2 +20,3 @@ # bare-fs | ||
fs.chmod | ||
fs.exists | ||
fs.fstat | ||
@@ -67,2 +68,3 @@ fs.ftruncate | ||
fs.closeSync | ||
fs.existsSync | ||
fs.fchmodSync | ||
@@ -69,0 +71,0 @@ fs.fstatSync |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119081
1472
92