Is there any difference between fs.ReadStream and fs.createReadStream in Node.js?

StackOverflow https://stackoverflow.com/questions/16927310

  •  31-05-2022
  •  | 
  •  

문제

In fs module in Node.js, is there any difference between fs.ReadStream and fs.createReadStream? As far as I know, both take filename and then create stream object...right?

도움이 되었습니까?

해결책

No

https://github.com/nodejs/node/blob/1124de2d76ad7118267d91a08485aa928a5f0865/lib/fs.js#L1711

fs.createReadStream = function(path, options) {
  return new ReadStream(path, options);
};

Fine print: YES. fs.createReadStream costs you 1 extra wrapper function call

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top