Skip to content

Save stream from socket.io stream package to the file #279

Answered by jimmywarting
CapLek asked this question in Q&A
Discussion options

You must be logged in to vote

If you have the possibility to save the file using nothing but the server then that would be my recommendation for solving things instead of using streamsaver to emulate what a server dose using service worker to get around the problem. streamsaver and other alike is mostly build for site that generates huge data on the client side (like a webcam recording)

anyhow... it looks like the stream is a NodeJS stream and not a whatwg (web) stream so .pipe() don't work together web streams uses pipeTo

so i bet u would have to read the stream and write manually to the StreamSaver

const stream = streamSaver.createWriteStream('filename.zip')
const writer = stream.getWriter()
writer.write(new Uint8Array

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@CapLek
Comment options

@jimmywarting
Comment options

@CapLek
Comment options

Answer selected by CapLek
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #278 on April 29, 2022 13:51.