Skip to content

Commit

Permalink
Merge d21da93 into a6e8cd6
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanis committed Nov 17, 2017
2 parents a6e8cd6 + d21da93 commit 6516718
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib/fs/index.js
Expand Up @@ -9,6 +9,7 @@ const api = [
'chmod',
'chown',
'close',
'copyFile',
'fchmod',
'fchown',
'fdatasync',
Expand All @@ -20,6 +21,7 @@ const api = [
'link',
'lstat',
'mkdir',
'mkdtemp',
'open',
'readFile',
'readdir',
Expand All @@ -33,12 +35,13 @@ const api = [
'unlink',
'utimes',
'writeFile'
]
// Add methods that are only in some Node.js versions
// fs.copyFile was added in Node.js v8.5.0
typeof fs.copyFile === 'function' && api.push('copyFile')
// fs.mkdtemp() was added in Node.js v5.10.0
typeof fs.mkdtemp === 'function' && api.push('mkdtemp')
].filter(key => {
// Some commands are not available on some systems. Ex:
// fs.copyFile was added in Node.js v8.5.0
// fs.mkdtemp was added in Node.js v5.10.0
// fs.lchown is not available on at least some Linux
return typeof fs[key] === 'function'
})

// Export all keys:
Object.keys(fs).forEach(key => {
Expand Down

0 comments on commit 6516718

Please sign in to comment.