Skip to content

Commit

Permalink
Add isSymbolicLink.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 27, 2018
1 parent b3bacae commit fec9c27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ readdir('/').then((files) => {
// mode: {
// number: 16877,
// string: 'drwxr-xr-x',
// isSymbolicLink: true,
// owner: { read: true, write: true, execute: true },
// group: { read: true, write: false, execute: true },
// others: { read: true, write: false, execute: true }
Expand Down Expand Up @@ -69,6 +70,7 @@ getStat('/var').then((Stats) => {
// mode: {
// number: 16877,
// string: 'drwxr-xr-x',
// isSymbolicLink: true,
// owner: { read: true, write: true, execute: true },
// group: { read: true, write: false, execute: true },
// others: { read: true, write: false, execute: true }
Expand Down
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Mode = require('stat-mode');
exports.getStat = async (currentPath, names) => {
if (!names) names = await this.uidToName();
return new Promise((resolve, reject) => {
fs.stat(currentPath, (err, stat) => {
fs.lstat(currentPath, (err, stat) => {
if (err) reject(err);
else {
const mode = new Mode(stat);
Expand All @@ -15,6 +15,7 @@ exports.getStat = async (currentPath, names) => {
}
stat.mode = {
number: stat.mode,
isSymbolicLink: mode.isSymbolicLink(),
string: mode.toString(),
owner: { ...mode.owner },
group: { ...mode.group },
Expand Down

0 comments on commit fec9c27

Please sign in to comment.