gridfs-stream中的Writestream是什么?它有什么作用?另外,从写入流创建读取流所需的路径是什么
var writestream = gfs.createWriteStream({
filename: 'my_file.txt'
});
fs.createReadStream('/some/path').pipe(writestream);
// streaming from gridfs
var readstream = gfs.createReadStream({
filename: 'my_file.txt'
});
//error handling, e.g. file does not exist
readstream.on('error', function (err) {
console.log('An error occurred!', err);
throw err;
});
readstream.pipe(response);