DenoDDeno
Powered by
.Literfieber.
Denoβ€’4y agoβ€’
6 replies
.Literfieber

How to transform a Readable Stream to a file.

I have a ReadableStream from a post request and i cant find a way to transform the body(ReadableStream) to a file. I tried to pipe the ReadableStream into a file like this

const file = await Deno.open('./test.png', {create: true,write: true,})
myPostRequest.body.pipeTo(file.writable);
file.close();

I always get:
error: Uncaught (in promise) BadResource: Bad resource ID
at async write (deno:ext/net/01_net.js:33:12)
at async Object.write (deno:ext/net/01_net.js:82:25)

what is the correct way to create a file from a readable stream ?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,944Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

node stream.Readable.on not a function.
JacobZwangJJacobZwang / help
2y ago
Stream a Sharp object / Node Readable with Deno.serve()
functiondjFfunctiondj / help
2y ago
How can I flush a stream to a response?
it's em!Iit's em! / help
3y ago
File Permissions on Deno.FileInfo
IndustrialIIndustrial / help
3y ago