template
template copied to clipboard
Streaming file content
Enhancement Request
Your issue may already be reported! Please check out our active issues before creating one.
Is Your Enhancement Request Related to an Issue?
At present, we load all file contents into memory and do a singular RegExp match and replace operation. Doing it this way is not optimal (not too impactful, but we strive to ship good software c;);
- Will require more memory
- Will impact runtime performance
Describe the Solution You'd Like
File streaming.
Instead of loading the file contents into memory, we can just;
- stream each line of the file into memory
- format the line with the same RegExp
- stream the formatted line into a generated file in a generated
tempdirectory - then replace the original file with the formatted file
[!NOTE] I have already tried to implement this, albeit unsuccessfully. You can find my unsuccessful code highlighted here.
Additional Context
PRs welcome!