Nodejs writes the file createWriteStream first, then reads the file content createReadStream, and cannot obtain the information.

  node.js, question
request(url).pipe(fs.createWriteStream(fpath));
 
 var bu = fs.createReadStream(fpath, {start: 0, end: 262});
 dlog(bu);

I wrote the file before reading the contents, but createReadStream could not read the contents. Why is this? Is it because the above operation is asynchronous? If so, how should it be obtained?

streamIs asynchronous operation, you this synchronous writing is not the result, so to:

request(url)
 .pipe(fs.createWriteStream(fpath))
 .on('close', function() {
 var bu = fs.createReadStream(fpath, {start: 0, end: 262});
 bu.on('data', function(chunk) {
 console.log(chunk.toString());  //This is the result
 });
 });

Read more documents:fs