attain icon indicating copy to clipboard operation
attain copied to clipboard

How to handle big file upload?

Open devalexqt opened this issue 4 years ago • 5 comments

For express/node we have req stream pipe to file on disk, so do we have this option in deno?

devalexqt avatar May 28 '20 01:05 devalexqt

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.

aaronwlee avatar May 28 '20 01:05 aaronwlee

Now I'm searching...

devalexqt avatar May 28 '20 09:05 devalexqt

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);
});

devalexqt avatar May 28 '20 16:05 devalexqt

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

devalexqt avatar May 28 '20 21:05 devalexqt

https://github.com/denoland/deno/issues/5996

devalexqt avatar May 31 '20 21:05 devalexqt