- Version: 10.4.1
- Platform: Amazon Linux 2, kernel 4.14 x64
- Subsystem: fs, experimental promises api
constfs=require('fs')fs.promises.readFile('/proc/stat',{encoding: 'utf8'}).then(r=>console.log(r.length))// => 0fs.readFile('/proc/stat',{encoding: 'utf8'},(e,r)=>console.log(r.length))// => 2347console.log(fs.readFileSync('/proc/stat',{encoding: 'utf8'}).length)// => 2347I'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…
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…