黄舟2017-04-17 14:40:17
The following function reads the file. After Node.js reads the file, data
is saved in binary Buffer
format. The data in Blob
format is also saved in binary mode, so it can be said that data
This is what the questioner wanted Blob binary data
. I don’t know if it solves the questioner’s problem.
var fs = require('fs')
fs.readFile('/etc/passwd', function (err, data) {
if (err) throw err
console.log('isBuffer: ' + Buffer.isBuffer(data)) // isBuffer: true
console.log(data) // <Buffer 72 6f ... >
})