summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/tsc/dts/lib.deno.ns.d.ts30
-rw-r--r--ext/io/12_io.js44
-rw-r--r--runtime/js/90_deno_ns.js2
-rw-r--r--runtime/js/99_main.js4
-rw-r--r--tests/specs/future/runtime_api/main.js2
-rw-r--r--tests/specs/future/runtime_api/main.out2
-rw-r--r--tests/unit/files_test.ts136
7 files changed, 0 insertions, 220 deletions
diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts
index 3ec06bf0b..8d9384580 100644
--- a/cli/tsc/dts/lib.deno.ns.d.ts
+++ b/cli/tsc/dts/lib.deno.ns.d.ts
@@ -1863,36 +1863,6 @@ declare namespace Deno {
options?: { bufSize?: number },
): Promise<number>;
- /**
- * Turns a Reader, `r`, into an async iterator.
- *
- * @deprecated This will be removed in Deno 2.0. See the
- * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
- * for migration instructions.
- *
- * @category I/O
- */
- export function iter(
- r: Reader,
- options?: { bufSize?: number },
- ): AsyncIterableIterator<Uint8Array>;
-
- /**
- * Turns a ReaderSync, `r`, into an iterator.
- *
- * @deprecated This will be removed in Deno 2.0. See the
- * {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
- * for migration instructions.
- *
- * @category I/O
- */
- export function iterSync(
- r: ReaderSync,
- options?: {
- bufSize?: number;
- },
- ): IterableIterator<Uint8Array>;
-
/** Open a file and resolve to an instance of {@linkcode Deno.FsFile}. The
* file does not need to previously exist if using the `create` or `createNew`
* open options. The caller may have the resulting file automatically closed
diff --git a/ext/io/12_io.js b/ext/io/12_io.js
index 5c31c279b..6e95a9bca 100644
--- a/ext/io/12_io.js
+++ b/ext/io/12_io.js
@@ -64,48 +64,6 @@ async function copy(
return n;
}
-async function* iter(
- r,
- options,
-) {
- internals.warnOnDeprecatedApi(
- "Deno.iter()",
- new Error().stack,
- "Use `ReadableStream` instead.",
- );
- const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
- const b = new Uint8Array(bufSize);
- while (true) {
- const result = await r.read(b);
- if (result === null) {
- break;
- }
-
- yield TypedArrayPrototypeSubarray(b, 0, result);
- }
-}
-
-function* iterSync(
- r,
- options,
-) {
- internals.warnOnDeprecatedApi(
- "Deno.iterSync()",
- new Error().stack,
- "Use `ReadableStream` instead.",
- );
- const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE;
- const b = new Uint8Array(bufSize);
- while (true) {
- const result = r.readSync(b);
- if (result === null) {
- break;
- }
-
- yield TypedArrayPrototypeSubarray(b, 0, result);
- }
-}
-
function readSync(rid, buffer) {
if (buffer.length === 0) return 0;
const nread = core.readSync(rid, buffer);
@@ -338,8 +296,6 @@ const stderr = new Stderr();
export {
copy,
- iter,
- iterSync,
read,
readAll,
readAllSync,
diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js
index a958108a9..0fb9273bc 100644
--- a/runtime/js/90_deno_ns.js
+++ b/runtime/js/90_deno_ns.js
@@ -104,8 +104,6 @@ const denoNs = {
writeAll: buffer.writeAll,
writeAllSync: buffer.writeAllSync,
copy: io.copy,
- iter: io.iter,
- iterSync: io.iterSync,
SeekMode: io.SeekMode,
read(rid, buffer) {
internals.warnOnDeprecatedApi(
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 17b1e20d8..e0fb86a3f 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -825,8 +825,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
- delete Deno.iter;
- delete Deno.iterSync;
delete Deno.readAll;
delete Deno.readAllSync;
delete Deno.read;
@@ -1007,8 +1005,6 @@ function bootstrapWorkerRuntime(
delete Deno.FsFile.prototype.rid;
delete Deno.funlock;
delete Deno.funlockSync;
- delete Deno.iter;
- delete Deno.iterSync;
delete Deno.readAll;
delete Deno.readAllSync;
delete Deno.read;
diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js
index 503b6e5fb..0c03dab33 100644
--- a/tests/specs/future/runtime_api/main.js
+++ b/tests/specs/future/runtime_api/main.js
@@ -14,8 +14,6 @@ console.log(
);
console.log("Deno.funlock is", Deno.funlock);
console.log("Deno.funlockSync is", Deno.funlockSync);
-console.log("Deno.iter is", Deno.iter);
-console.log("Deno.iterSync is", Deno.iterSync);
console.log("Deno.readAll is", Deno.readAll);
console.log("Deno.readAllSync is", Deno.readAllSync);
console.log("Deno.read is", Deno.read);
diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out
index eca1c3741..f04a0b4e9 100644
--- a/tests/specs/future/runtime_api/main.out
+++ b/tests/specs/future/runtime_api/main.out
@@ -11,8 +11,6 @@ Deno.flockSync is undefined
Deno.FsFile.prototype.rid is undefined
Deno.funlock is undefined
Deno.funlockSync is undefined
-Deno.iter is undefined
-Deno.iterSync is undefined
Deno.readAll is undefined
Deno.readAllSync is undefined
Deno.read is undefined
diff --git a/tests/unit/files_test.ts b/tests/unit/files_test.ts
index 71c5a4561..fb45e3ad6 100644
--- a/tests/unit/files_test.ts
+++ b/tests/unit/files_test.ts
@@ -34,142 +34,6 @@ Deno.test(
);
Deno.test(
- { ignore: DENO_FUTURE, permissions: { read: true } },
- async function filesIter() {
- const filename = "tests/testdata/assets/hello.txt";
- using file = await Deno.open(filename);
-
- let totalSize = 0;
- for await (const buf of Deno.iter(file)) {
- totalSize += buf.byteLength;
- }
-
- assertEquals(totalSize, 12);
- },
-);
-
-Deno.test(
- { ignore: DENO_FUTURE, permissions: { read: true } },
- async function filesIterCustomBufSize() {
- const filename = "tests/testdata/assets/hello.txt";
- using file = await Deno.open(filename);
-
- let totalSize = 0;
- let iterations = 0;
- for await (const buf of Deno.iter(file, { bufSize: 6 })) {
- totalSize += buf.byteLength;
- iterations += 1;
- }
-
- assertEquals(totalSize, 12);
- assertEquals(iterations, 2);
- },
-);
-
-Deno.test(
- { ignore: DENO_FUTURE, permissions: { read: true } },
- function filesIterSync() {
- const filename = "tests/testdata/assets/hello.txt";
- using file = Deno.openSync(filename);
-
- let totalSize = 0;
- for (const buf of Deno.iterSync(file)) {
- totalSize += buf.byteLength;
- }
-
- assertEquals(totalSize, 12);
- },
-);
-
-Deno.test(
- { ignore: DENO_FUTURE, permissions: { read: true } },
- function filesIterSyncCustomBufSize() {
- const filename = "tests/testdata/assets/hello.txt";
- using file = Deno.openSync(filename);
-
- let totalSize = 0;
- let iterations = 0;
- for (const buf of Deno.iterSync(file, { bufSize: 6 })) {
- totalSize += buf.byteLength;
- iterations += 1;
- }
-
- assertEquals(totalSize, 12);
- assertEquals(iterations, 2);
- },
-);
-
-Deno.test({ ignore: DENO_FUTURE }, async function readerIter() {
- // ref: https://github.com/denoland/deno/issues/2330
- const encoder = new TextEncoder();
-
- class TestReader implements Deno.Reader {
- #offset = 0;
- #buf: Uint8Array;
-
- constructor(s: string) {
- this.#buf = new Uint8Array(encoder.encode(s));
- }
-
- read(p: Uint8Array): Promise<number | null> {
- const n = Math.min(p.byteLength, this.#buf.byteLength - this.#offset);
- p.set(this.#buf.slice(this.#offset, this.#offset + n));
- this.#offset += n;
-
- if (n === 0) {
- return Promise.resolve(null);
- }
-
- return Promise.resolve(n);
- }
- }
-
- const reader = new TestReader("hello world!");
-
- let totalSize = 0;
- for await (const buf of Deno.iter(reader)) {
- totalSize += buf.byteLength;
- }
-
- assertEquals(totalSize, 12);
-});
-
-Deno.test({ ignore: DENO_FUTURE }, async function readerIterSync() {
- // ref: https://github.com/denoland/deno/issues/2330
- const encoder = new TextEncoder();
-
- class TestReader implements Deno.ReaderSync {
- #offset = 0;
- #buf: Uint8Array;
-
- constructor(s: string) {
- this.#buf = new Uint8Array(encoder.encode(s));
- }
-
- readSync(p: Uint8Array): number | null {
- const n = Math.min(p.byteLength, this.#buf.byteLength - this.#offset);
- p.set(this.#buf.slice(this.#offset, this.#offset + n));
- this.#offset += n;
-
- if (n === 0) {
- return null;
- }
-
- return n;
- }
- }
-
- const reader = new TestReader("hello world!");
-
- let totalSize = 0;
- for await (const buf of Deno.iterSync(reader)) {
- totalSize += buf.byteLength;
- }
-
- assertEquals(totalSize, 12);
-});
-
-Deno.test(
{
permissions: { read: true, write: true },
},