Skip to main content

@std/io@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function copy
copy(
src: Reader,
dst: Writer,
options?: { bufSize?: number; }
): Promise<number>

Copies from src to dst until either EOF (null) is read from src or an error occurs. It resolves to the number of bytes copied or rejects with the first error encountered while copying.

Examples

Example 1

import { copy } from "@std/io/copy";

const source = await Deno.open("my_file.txt");
const bytesCopied1 = await copy(source, Deno.stdout);
const destination = await Deno.create("my_file_2.txt");
const bytesCopied2 = await copy(source, destination);

Parameters

The source to copy from

The destination to copy to

optional
options: { bufSize?: number; }

Can be used to tune size of the buffer. Default size is 32kB

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/io

Import symbol

import { copy } from "@std/io";
or

Import directly with a jsr specifier

import { copy } from "jsr:@std/io";