Closed
Description
- Version: 10.4.1
- Platform: Amazon Linux 2, kernel 4.14 x64
- Subsystem: fs, experimental promises api
const fs = require('fs')
fs.promises.readFile('/proc/stat', { encoding: 'utf8' }).then(r => console.log(r.length)) // => 0
fs.readFile('/proc/stat', { encoding: 'utf8' }, (e, r) => console.log(r.length)) // => 2347
console.log(fs.readFileSync('/proc/stat', { encoding: 'utf8' }).length) // => 2347
I'm not sure how promises API differs from classic one, but this behaviour is surprising, and I can't find anything in the docs that would explain what I am doing wrong…