.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 ?
7 replies