• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var fs = require('fs')
3var semver = require('semver')
4var isWindows = process.platform === 'win32'
5
6// fs.access first introduced in node 0.12 / io.js
7if (!fs.access) {
8  module.exports = false
9} else if (!isWindows) {
10  // fs.access always works on non-Windows OSes
11  module.exports = true
12} else {
13  // The Windows implementation of `fs.access` has a bug where it will
14  // sometimes return access errors all the time for directories, even
15  // when access is available. As all we actually test ARE directories, this
16  // is a bit of a problem.
17  // This was fixed in io.js version 1.5.0
18  // As of 2015-07-20, it is still unfixed in node:
19  // https://github.com/joyent/node/issues/25657
20
21  module.exports = semver.gte(process.version, '1.5.0')
22}
23