I confront with a problem about converting buffer into stream in Nodejs.Here is the code:
var fs = require('fs');
var b = Buffer([80,80,80,80]);
var readStream = fs.createReadStream({path:b});
The code raise an exception:
TypeError: path must be a string or Buffer
However the document of Nodejs says that Buffer is acceptable by fs.createReadStream().
fs.createReadStream(path[, options])
path <string> | <Buffer> | <URL>
options <string> | <Object>
Anybody could answer the question? Thanks very much!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…