fs.createReadStream()
has an option you can pass it to specify the start position for the stream.
let f = fs.createReadStream("myfile.txt", {start: 1000});
You could also open a normal file descriptor with fs.open()
, then fs.read()
one byte from a position right before where you want the stream to be positioned using the position argument to fs.read()
and then you can pass that file descriptor into fs.createReadStream()
as an option and the stream will start with that file descriptor and position (though obviously the start
option to fs.createReadStream()
is a bit simpler).