realpath-native
Advanced tools
Comparing version 1.0.0 to 1.0.1
29
index.js
@@ -6,2 +6,4 @@ 'use strict'; | ||
const promisiedFsRealpath = promisify(fs.realpath); | ||
function realpath(filepath) { | ||
@@ -11,10 +13,15 @@ if (typeof fs.realpath.native === 'function') { | ||
} | ||
const fsBinding = process.binding('fs'); | ||
return new Promise((resolve, reject) => { | ||
try { | ||
resolve(process.binding('fs').realpath(filepath, 'utf8')); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
if (fsBinding.realpath) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
resolve(fsBinding.realpath(filepath, 'utf8')); | ||
} catch (e) { | ||
reject(e); | ||
} | ||
}); | ||
} | ||
return promisiedFsRealpath(filepath); | ||
} | ||
@@ -27,3 +34,9 @@ | ||
return process.binding('fs').realpath(filepath, 'utf8'); | ||
const fsBinding = process.binding('fs'); | ||
if (fsBinding.realpath) { | ||
return process.binding('fs').realpath(filepath, 'utf8'); | ||
} | ||
return fs.realpathSync(filepath); | ||
} | ||
@@ -30,0 +43,0 @@ |
@@ -1,1 +0,55 @@ | ||
{"name":"realpath-native","version":"1.0.0","main":"index.js","files":["index.js"],"description":"Use the system's native `realpath`","repository":"SimenB/realpath-native","author":"Simen Bekkhus <sbekkhus91@gmail.com>","license":"MIT","keywords":["realpath"],"engines":{"node":">=4"},"scripts":{"lint":"eslint .","test":"eslint ."},"dependencies":{"util.promisify":"^1.0.0"},"devDependencies":{"@commitlint/cli":"^5.2.5","@commitlint/config-conventional":"^5.2.3","eslint":"^4.13.1","eslint-config-simenb-base":"^14.0.0","eslint-config-simenb-node":"^0.4.11","husky":"^0.14.3","lint-staged":"^6.0.0","prettier":"^1.9.2","semantic-release":"11.0.1"},"commitlint":{"extends":["@commitlint/config-conventional"]},"prettier":{"proseWrap":"always","singleQuote":true,"trailingComma":"es5"},"lint-staged":{"*.js":["eslint --fix","git add"],"*.{md,json}":["prettier --write","git add"]}} | ||
{ | ||
"name": "realpath-native", | ||
"version": "1.0.1", | ||
"main": "index.js", | ||
"files": [ | ||
"index.js" | ||
], | ||
"description": "Use the system's native `realpath`", | ||
"repository": "SimenB/realpath-native", | ||
"author": "Simen Bekkhus <sbekkhus91@gmail.com>", | ||
"license": "MIT", | ||
"keywords": [ | ||
"realpath" | ||
], | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"scripts": { | ||
"lint": "eslint .", | ||
"test": "eslint ." | ||
}, | ||
"dependencies": { | ||
"util.promisify": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^6.0.2", | ||
"@commitlint/config-conventional": "^6.0.2", | ||
"eslint": "^4.13.1", | ||
"eslint-config-simenb-base": "^14.0.0", | ||
"eslint-config-simenb-node": "^0.4.11", | ||
"husky": "^0.14.3", | ||
"lint-staged": "^6.0.0", | ||
"prettier": "^1.9.2" | ||
}, | ||
"commitlint": { | ||
"extends": [ | ||
"@commitlint/config-conventional" | ||
] | ||
}, | ||
"prettier": { | ||
"proseWrap": "always", | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
}, | ||
"lint-staged": { | ||
"*.js": [ | ||
"eslint --fix", | ||
"git add" | ||
], | ||
"*.{md,json}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
} | ||
} |
@@ -17,2 +17,4 @@ # realpath-native | ||
On node 4 the function uses the old `fs.realpath` function. | ||
## Install | ||
@@ -19,0 +21,0 @@ |
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
4502
8
32
61