summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshat Agarwal <humancalico@disroot.org>2020-04-27 01:56:02 +0530
committerGitHub <noreply@github.com>2020-04-26 16:26:02 -0400
commit4f9bb11444ba7236f28ef1e722100b485c185c7c (patch)
tree9b5b19bcaf1a440166c7ecf814a65fb343343628
parent26dfd3c110ced12f2bd374de391c2c05e24290d8 (diff)
reorder copyN arguments to match Deno.copy (#4900)
-rw-r--r--std/io/ioutil.ts2
-rw-r--r--std/io/ioutil_test.ts4
-rw-r--r--std/io/readers_test.ts2
-rw-r--r--std/io/writers_test.ts2
-rw-r--r--std/mime/multipart.ts4
5 files changed, 7 insertions, 7 deletions
diff --git a/std/io/ioutil.ts b/std/io/ioutil.ts
index cfcfdf794..9a727f436 100644
--- a/std/io/ioutil.ts
+++ b/std/io/ioutil.ts
@@ -8,8 +8,8 @@ import { assert } from "../testing/asserts.ts";
* If read size is lesser than N, then returns nread
* */
export async function copyN(
- dest: Writer,
r: Reader,
+ dest: Writer,
size: number
): Promise<number> {
let bytesRead = 0;
diff --git a/std/io/ioutil_test.ts b/std/io/ioutil_test.ts
index d00986da5..bb01811ad 100644
--- a/std/io/ioutil_test.ts
+++ b/std/io/ioutil_test.ts
@@ -73,7 +73,7 @@ Deno.test(function testSliceLongToBytes2(): void {
Deno.test(async function testCopyN1(): Promise<void> {
const w = new Buffer();
const r = stringsReader("abcdefghij");
- const n = await copyN(w, r, 3);
+ const n = await copyN(r, w, 3);
assertEquals(n, 3);
assertEquals(w.toString(), "abc");
});
@@ -81,7 +81,7 @@ Deno.test(async function testCopyN1(): Promise<void> {
Deno.test(async function testCopyN2(): Promise<void> {
const w = new Buffer();
const r = stringsReader("abcdefghij");
- const n = await copyN(w, r, 11);
+ const n = await copyN(r, w, 11);
assertEquals(n, 10);
assertEquals(w.toString(), "abcdefghij");
});
diff --git a/std/io/readers_test.ts b/std/io/readers_test.ts
index 041fd78a8..05b63b892 100644
--- a/std/io/readers_test.ts
+++ b/std/io/readers_test.ts
@@ -30,7 +30,7 @@ test(async function ioStringReader(): Promise<void> {
test(async function ioMultiReader(): Promise<void> {
const r = new MultiReader(new StringReader("abc"), new StringReader("def"));
const w = new StringWriter();
- const n = await copyN(w, r, 4);
+ const n = await copyN(r, w, 4);
assertEquals(n, 4);
assertEquals(w.toString(), "abcd");
await copy(r, w);
diff --git a/std/io/writers_test.ts b/std/io/writers_test.ts
index 96dc044ae..24f2f3b3f 100644
--- a/std/io/writers_test.ts
+++ b/std/io/writers_test.ts
@@ -7,7 +7,7 @@ import { copyN } from "./ioutil.ts";
test(async function ioStringWriter(): Promise<void> {
const w = new StringWriter("base");
const r = new StringReader("0123456789");
- await copyN(w, r, 4);
+ await copyN(r, w, 4);
assertEquals(w.toString(), "base0123");
await copy(r, w);
assertEquals(w.toString(), "base0123456789");
diff --git a/std/mime/multipart.ts b/std/mime/multipart.ts
index 709752290..027854dae 100644
--- a/std/mime/multipart.ts
+++ b/std/mime/multipart.ts
@@ -297,7 +297,7 @@ export class MultipartReader {
buf.reset();
if (!p.fileName) {
// value
- const n = await copyN(buf, p, maxValueBytes);
+ const n = await copyN(p, buf, maxValueBytes);
maxValueBytes -= n;
if (maxValueBytes < 0) {
throw new RangeError("message too large");
@@ -320,8 +320,8 @@ export class MultipartReader {
});
try {
const size = await copyN(
- file,
new MultiReader(buf, p),
+ file,
maxValueBytes
);
file.close();