summaryrefslogtreecommitdiff
path: root/std/io/ioutil.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/io/ioutil.ts')
-rw-r--r--std/io/ioutil.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/std/io/ioutil.ts b/std/io/ioutil.ts
index 7b6761708..c7b92fc1d 100644
--- a/std/io/ioutil.ts
+++ b/std/io/ioutil.ts
@@ -24,7 +24,10 @@ export async function copyN(
const nread = result ?? 0;
bytesRead += nread;
if (nread > 0) {
- const n = await dest.write(buf.slice(0, nread));
+ let n = 0;
+ while (n < nread) {
+ n += await dest.write(buf.slice(n, nread));
+ }
assert(n === nread, "could not write");
}
if (result === null) {