n00b
n00b

Reputation: 6340

Should I use NodeJS streams for small files?

Does it always make sense to use the streams API for returning binary/blobs or are there disadvantages when using them for small files?

I am considering using a NodeJS proxy to return small images (~60KB) stored in S3. This is so I can add a layer of auth in NodeJS. From what I've read, NodeJS streams will be more memory efficient and faster for large files, however, I am wondering if there are any advantages or disadvantages when using streams for small files.

Upvotes: 0

Views: 353

Answers (1)

Ruan Martinelli
Ruan Martinelli

Reputation: 364

I would not use streams on this case. The file size is too small to justify the added complexity on the implementation.

If you have a hard requirement on performance, you might achieve better results optimizing the images rather than the transport.

Upvotes: 1

Related Questions