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

Streaming binary and base64 files

Posted on Jun 25 • Originally published at sevic.dev on Jun 25 Streaming is useful when dealing with big files in web apps. Instead of loading the entire file into memory before sending it to the client, streaming allows you to send it in small chunks, improving memory efficiency and reducing response time.The code snippet below shows streaming the binary CSV and base64-encoded PDF files with NestJS. Use the same approach for other types of files, like JSON files.Set content type and filename headers so files are streamed and downloaded correctly. Base64 file is converted to a buffer and streamed afterward. Read files from a file system or by API calls.Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well Confirm For further actions, you may consider blocking this person and/or reporting abuse Uddesh - Jun 4 Nicklas Gellner - Jun 20 Chris Wang - Jun 9 Rubén Alapont - Jun 16 Once suspended, Zsevic will not be able to comment or publish posts until their suspension is removed. Once unsuspended, zsevic will be able to comment and publish posts again. Once unpublished, all posts by zsevic will become hidden and only accessible to themselves. If zsevic is not suspended, they can still re-publish their posts from their dashboard. Note: Once unpublished, this post will become invisible to the public and only accessible to Željko Šević. They can still re-publish the post if they are not suspended. Thanks for keeping DEV Community safe. Here is what you can do to flag zsevic: zsevic consistently posts content that violates DEV Community's code of conduct because it is harassing, offensive or spammy. Unflagging zsevic will restore default visibility to their posts. DEV Community — A constructive and inclusive social network for software developers. With you every step of your journey. Built on Forem — the open source software that powers DEV and other inclusive communities.Made with love and Ruby on Rails. DEV Community © 2016 - 2023. We're a place where coders share, stay up-to-date and grow their careers.



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Streaming binary and base64 files

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×