New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support passing ReadableStream
to Deno.writeFile
#13229
Labels
help wanted
community help requested
public API
related to "Deno" namespace in JS
suggestion
suggestions for new features (yet to be agreed)
Comments
lucacasonato
added
public API
related to "Deno" namespace in JS
suggestion
suggestions for new features (yet to be agreed)
labels
Dec 29, 2021
Maybe this can be closed? See #13614. |
It would be nice, since right now the file upload goes something like this: import { readAll, readerFromStreamReader } from "https://deno.land/std@0.171.0/streams/conversion.ts";
//// body: FormData
const firstFile = body.get('file');
if (firstFile instanceof File) {
const fileDest = firstFile.name;
// write the file if the file has content in memory
if (firstFile.size) {
const reader = firstFile.stream().getReader();
const stream = readerFromStreamReader(reader);
const file = await readAll(stream);
await Deno.writeFile(fileDest, file, { append: true });
}
} |
This is reasonable and we should implement this. PRs are very welcome! |
crowlKats
added a commit
that referenced
this issue
Jan 12, 2023
dsherret
pushed a commit
that referenced
this issue
Jan 13, 2023
#19697 tracks a bug in the passing of |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
help wanted
community help requested
public API
related to "Deno" namespace in JS
suggestion
suggestions for new features (yet to be agreed)
This would make streaming data to disk really easy.
writeFile
cancellations should be propagated into the readable stream reading. OnlyReadableStream<Uint8Array>
would be allowed.writeTextFile
would allowReadableStream<string>
.This would be in addition to allowing
Uint8Array
/string
as we do now.The text was updated successfully, but these errors were encountered: