Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Readable stream implementation for big strings

Readable stream implementation for big strings

Problem

I want to implement a Readable Stream for strings that can have a size of 1MB+, they are created by processing some files of a big size too. These strings will be sent by HTTP protocol to multiple clients and it is needed to send their content asynchronously. The question is: How should I organize the string spliting / reading and what size should I use for the chunked data? In the File System module, as I observed, it is used the size of 64KB when streaming file.

Problem courtesy of: micnic

Solution

Check out GridFS in MongoDB.

You can handle files in chunks in MongoDB using GridFS.

It is pretty straightforward.

Save with file type and download it with appropriate file type.

Solution courtesy of: InspiredJW

Discussion

View additional discussion.



This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Readable stream implementation for big strings

×

Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription

×