How to use WriteStream with api endpoints? #10249
Unanswered
AhsanSarwar45
asked this question in
Q&A
Replies: 1 comment
-
If your package only works with Node.js streams and not web streams you likely have to convert between the two using // +server.js
import { Readable } from 'node:stream';
import stream from 'youtube-audio-stream';
export function POST(event) {
const web_rstream = Readable.toWeb(stream(url));
return new Response(web_rstream);
} It requires at least Node.js 17.0.0. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a 'stream' function that returns a WriteStream. The usage in express is like this:
How can I do the equivalent in svelte kit api endpoints? The docs gives example of ReadableStream but not WriteStream.
Beta Was this translation helpful? Give feedback.
All reactions