Try writing the stream manually (same result)

This commit is contained in:
Manav Rathi 2024-04-15 21:37:38 +05:30
parent 8d76966d99
commit a5be903abe
No known key found for this signature in database

View file

@ -37,7 +37,16 @@ export const registerStreamProtocol = () => {
/* host-pathname----- */
case "write":
try {
await writeStream(path, request.body);
// await writeStream(path, request.body);
console.log("starting stream");
let c = 0;
for await (const p of request.body as any) {
if (c == 327680) console.log(p);
fs.appendFile(path, p);
c += p.length;
}
console.log("ending stream");
return new Response("", { status: 200 });
} catch (e) {
log.error(`Failed to write stream for ${url}`, e);