Skip to content

nicole-samuels/node-js-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Node JS Challenge

We have a daily log file that is X in size. We need to convert this CSV data into JSON format. The problem? Our cloud instance only has 512MB of RAM. If you try to fs.readFileSync the whole file, the server crashes with "Heap Out of Memory."

Task

Write a script using Node Streams (fs.createReadStream) to transform the file line-by-line without loading the whole thing into memory.

Rules

  • You can’t use fs.readFile or fs.readFileSync.

  • You must use the stream API (or a library like csv-parser that uses streams internally).

  • You must include e.g. process.memoryUsage() logs at the end to prove you didn't spike the RAM

Setup

Run

node generate_big_file.js

Then run

node main.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors