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

Is there a difference between fs.ReadStream and fs.createReadStream in the fs module in Node.js? As far as I know, both take the file name and then create the stream object ... right?

+4
source share
1 answer

No

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

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

Accurate print: YES. fs.createReadStream costs you 1 extra shell function call

+6
source

Source: https://habr.com/ru/post/1484504/


All Articles