Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes fs-extra on linux #520

Merged
merged 1 commit into from Nov 18, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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