diff options
Diffstat (limited to 'std')
-rw-r--r-- | std/archive/tar.ts | 2 | ||||
-rw-r--r-- | std/archive/tar_test.ts | 4 | ||||
-rw-r--r-- | std/examples/cat.ts | 2 | ||||
-rw-r--r-- | std/examples/curl.ts | 2 | ||||
-rw-r--r-- | std/http/io.ts | 2 | ||||
-rw-r--r-- | std/io/readers_test.ts | 2 | ||||
-rw-r--r-- | std/io/writers_test.ts | 2 | ||||
-rw-r--r-- | std/mime/multipart.ts | 4 | ||||
-rw-r--r-- | std/mime/multipart_test.ts | 2 |
9 files changed, 11 insertions, 11 deletions
diff --git a/std/archive/tar.ts b/std/archive/tar.ts index cafef8723..6bc2b92d0 100644 --- a/std/archive/tar.ts +++ b/std/archive/tar.ts @@ -470,7 +470,7 @@ export class Untar { while (rest > 0) { await this.reader.readFull(this.block); const arr = rest < recordSize ? this.block.subarray(0, rest) : this.block; - await Deno.copy(writer, new Deno.Buffer(arr)); + await Deno.copy(new Deno.Buffer(arr), writer); rest -= recordSize; } diff --git a/std/archive/tar_test.ts b/std/archive/tar_test.ts index ae3ee8138..cd22addcc 100644 --- a/std/archive/tar_test.ts +++ b/std/archive/tar_test.ts @@ -30,8 +30,8 @@ Deno.test(async function createTarArchive(): Promise<void> { await tar.append("dir/tar.ts", { filePath }); // write tar data to a buffer - const writer = new Deno.Buffer(), - wrote = await Deno.copy(writer, tar.getReader()); + const writer = new Deno.Buffer(); + const wrote = await Deno.copy(tar.getReader(), writer); /** * 3072 = 512 (header) + 512 (content) + 512 (header) + 512 (content) diff --git a/std/examples/cat.ts b/std/examples/cat.ts index 7b7af3145..cf9a7cb1d 100644 --- a/std/examples/cat.ts +++ b/std/examples/cat.ts @@ -2,6 +2,6 @@ const filenames = Deno.args; for (const filename of filenames) { const file = await Deno.open(filename); - await Deno.copy(Deno.stdout, file); + await Deno.copy(file, Deno.stdout); file.close(); } diff --git a/std/examples/curl.ts b/std/examples/curl.ts index 44ee66125..a3e8b73db 100644 --- a/std/examples/curl.ts +++ b/std/examples/curl.ts @@ -3,7 +3,7 @@ const url_ = Deno.args[0]; const res = await fetch(url_); // TODO(ry) Re-enable streaming in this example. -// Originally we did: await Deno.copy(Deno.stdout, res.body); +// Originally we did: await Deno.copy(res.body, Deno.stdout); // But maybe more JS-y would be: res.pipeTo(Deno.stdout); const body = new Uint8Array(await res.arrayBuffer()); diff --git a/std/http/io.ts b/std/http/io.ts index 37285fdbf..2c2fea48a 100644 --- a/std/http/io.ts +++ b/std/http/io.ts @@ -273,7 +273,7 @@ export async function writeResponse( const contentLength = headers.get("content-length"); assert(contentLength != null); const bodyLength = parseInt(contentLength); - const n = await Deno.copy(writer, r.body); + const n = await Deno.copy(r.body, writer); assert(n === bodyLength); } else { await writeChunkedBody(writer, r.body); diff --git a/std/io/readers_test.ts b/std/io/readers_test.ts index 22982c924..041fd78a8 100644 --- a/std/io/readers_test.ts +++ b/std/io/readers_test.ts @@ -33,6 +33,6 @@ test(async function ioMultiReader(): Promise<void> { const n = await copyN(w, r, 4); assertEquals(n, 4); assertEquals(w.toString(), "abcd"); - await copy(w, r); + await copy(r, w); assertEquals(w.toString(), "abcdef"); }); diff --git a/std/io/writers_test.ts b/std/io/writers_test.ts index 916ad043e..96dc044ae 100644 --- a/std/io/writers_test.ts +++ b/std/io/writers_test.ts @@ -9,6 +9,6 @@ test(async function ioStringWriter(): Promise<void> { const r = new StringReader("0123456789"); await copyN(w, r, 4); assertEquals(w.toString(), "base0123"); - await copy(w, r); + await copy(r, w); assertEquals(w.toString(), "base0123456789"); }); diff --git a/std/mime/multipart.ts b/std/mime/multipart.ts index c46948226..709752290 100644 --- a/std/mime/multipart.ts +++ b/std/mime/multipart.ts @@ -308,7 +308,7 @@ export class MultipartReader { } // file let formFile: FormFile | undefined; - const n = await copy(buf, p); + const n = await copy(p, buf); const contentType = p.headers.get("content-type"); assert(contentType != null, "content-type must be set"); if (n > maxMemory) { @@ -573,7 +573,7 @@ export class MultipartWriter { file: Reader ): Promise<void> { const f = await this.createFormFile(field, filename); - await copy(f, file); + await copy(file, f); } private flush(): Promise<void> { diff --git a/std/mime/multipart_test.ts b/std/mime/multipart_test.ts index 8b721a441..aa3b7524e 100644 --- a/std/mime/multipart_test.ts +++ b/std/mime/multipart_test.ts @@ -208,7 +208,7 @@ test({ assert(file.tempfile != null); const f = await open(file.tempfile); const w = new StringWriter(); - await copy(w, f); + await copy(f, w); const json = JSON.parse(w.toString()); assertEquals(json["compilerOptions"]["target"], "es2018"); f.close(); |