Skip to content

Commit

Permalink
Add promise support for missing fs methods
Browse files Browse the repository at this point in the history
Fixes #1044
  • Loading branch information
RyanZim committed Jan 10, 2025
1 parent d96f265 commit 89a1ae8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/fs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ const api = [
'chown',
'close',
'copyFile',
'cp',
'fchmod',
'fchown',
'fdatasync',
'fstat',
'fsync',
'ftruncate',
'futimes',
'glob',
'lchmod',
'lchown',
'lutimes',
'link',
'lstat',
'mkdir',
Expand All @@ -34,6 +37,7 @@ const api = [
'rm',
'rmdir',
'stat',
'statfs',
'symlink',
'truncate',
'unlink',
Expand All @@ -42,6 +46,8 @@ const api = [
].filter(key => {
// Some commands are not available on some systems. Ex:
// fs.cp was added in Node.js v16.7.0
// fs.statfs was added in Node v19.6.0, v18.15.0
// fs.glob was added in Node.js v22.0.0
// fs.lchown is not available on at least some Linux
return typeof fs[key] === 'function'
})
Expand Down

0 comments on commit 89a1ae8

Please sign in to comment.