-
|
Hi, This works fine for reading a How could one write contents in reverse order line by line? Or, have an event to process remote file in reverse order line by line? Example remote file: Looking to get a local file or readline event, but in reverse line order (not character order) Found this https://github.com/dominictarr/fs-reverse , but it's no longer maintained and works only for local files. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
This is a problem totally unrelated to Got, best if asked on StackOverflow :) Writing in reverse order is highly inefficient. Instead, read it in reverse. You can write offests of the line breaks (you can use a TransformStream). For example the offsets for are |
Beta Was this translation helpful? Give feedback.
This is a problem totally unrelated to Got, best if asked on StackOverflow :)
Writing in reverse order is highly inefficient. Instead, read it in reverse.
You can write offests of the line breaks (you can use a TransformStream). For example the offsets for
are
[6, 18, 25, 37]. Once the file is saved on disk, you can just passstartandendarguments in https://nodejs.org/api/fs.html#fscreatereadstreampath-options