Closed
Description
- Version: 9.6.1
- Platform: Windows 7 Professional x64
- Subsystem: fs
fs.access() returns no error when given a file/directory with no priveleges.
Code example:
'use strict'
const fs = require('fs')
fs.access('./restricted', fs.constants.R_OK || fs.constants.W_OK, err => {
if (err) {
console.log(err)
} else {
console.log('no access() error')
}
})
fs.stat('./restricted', (err, stat) => {
if (err) {
console.log(err)
} else {
console.log('no stat() error')
}
})
Output:
no access() error
{ Error: EPERM: operation not permitted
errno: -4048,
code: 'EPERM',
syscall: 'stat',
path: 'C:\\Workspaces\\restricted' }