attain
attain copied to clipboard
How to handle big file upload?
For express/node we have req stream pipe to file on disk, so do we have this option in deno?
As far as I know, deno doesn't have the stream yet. I'm also looking for how to upload the file... If you found the way, please let me know too.
Now I'm searching...
Some info: https://www.reddit.com/r/Deno/comments/ghiocq/is_there_a_way_to_handle_data_in_deno_by_using/
https://github.com/denoland/deno/blob/30702e2678200b6e21ba142347d2d213b86e9c6d/cli/tests/unit/streams_piping_test.ts
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { unitTest, assert, assertEquals } from "./test_util.ts";
import { assertThrowsAsync } from "../../../std/testing/asserts.ts";
unitTest(function streamPipeLocks() {
const rs = new ReadableStream();
const ws = new WritableStream();
assertEquals(rs.locked, false);
assertEquals(ws.locked, false);
rs.pipeTo(ws);
assert(rs.locked);
assert(ws.locked);
});
more info: https://stackoverflow.com/questions/62019830/how-can-i-write-files-in-deno
var file = await Deno.open('./test.txt', { write: true, create: true })
//then somehow pipe req data to file
...
https://github.com/denoland/deno/issues/5996