Today I Learned - Rocky Kev

TIL Node Streams

POSTED ON:

TAGS:

Today I learned about Node Streams!

via Node Streams

Without streams, you'll write the full content to the file before returning the control back to your program (in the async version, this means executing the callback).

Imagine if you did some data-extensive fetch request getting a 1 gig file. 1 gig can take a while, and it's fetching it in memory.

In this case, a better option is to write the file content using streams.

Why streams?

Streams basically provide two major advantages using other data handling methods:

Four Stream Types


Related TILs

Tagged:

TIL what is npm Script

Despite their high usage they are not particularly well optimized and add about 400ms of overhead. In this article we were able to bring that down to ~22ms.

TIL keywords in package.json

Today I learned what keywords are in a package.json file! It's a collection of keywords about a module. Keywords can help identify a package, related modules and software, and concepts.

TIL functional async/await

PLACEHOLDER