Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BREAKING(io): remove Deno.read[Sync]() #25409

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cli/bench/deno_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ Deno.bench("b64_rt_short", { n: 1e6 }, () => {
const buf = new Uint8Array(100);
const file = Deno.openSync("/dev/zero");
Deno.bench("read_zero", { n: 5e5 }, () => {
// deno-lint-ignore no-deprecated-deno-api
Deno.readSync(file.rid, buf);
file.readSync(buf);
});
}

Expand Down
64 changes: 0 additions & 64 deletions cli/tsc/dts/lib.deno.ns.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1920,70 +1920,6 @@ declare namespace Deno {
*/
export function createSync(path: string | URL): FsFile;

/** Read from a resource ID (`rid`) into an array buffer (`buffer`).
*
* Resolves to either the number of bytes read during the operation or EOF
* (`null`) if there was nothing more to read.
*
* It is possible for a read to successfully return with `0` bytes. This does
* not indicate EOF.
*
* This function is one of the lowest level APIs and most users should not
* work with this directly, but rather use {@linkcode ReadableStream} and
* {@linkcode https://jsr.io/@std/streams/doc/to-array-buffer/~/toArrayBuffer | toArrayBuffer}
* instead.
*
* **It is not guaranteed that the full buffer will be read in a single call.**
*
* ```ts
* // if "/foo/bar.txt" contains the text "hello world":
* using file = await Deno.open("/foo/bar.txt");
* const buf = new Uint8Array(100);
* const numberOfBytesRead = await Deno.read(file.rid, buf); // 11 bytes
* const text = new TextDecoder().decode(buf); // "hello world"
* ```
*
* @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 read(rid: number, buffer: Uint8Array): Promise<number | null>;

/** Synchronously read from a resource ID (`rid`) into an array buffer
* (`buffer`).
*
* Returns either the number of bytes read during the operation or EOF
* (`null`) if there was nothing more to read.
*
* It is possible for a read to successfully return with `0` bytes. This does
* not indicate EOF.
*
* This function is one of the lowest level APIs and most users should not
* work with this directly, but rather use {@linkcode ReadableStream} and
* {@linkcode https://jsr.io/@std/streams/doc/to-array-buffer/~/toArrayBuffer | toArrayBuffer}
* instead.
*
* **It is not guaranteed that the full buffer will be read in a single
* call.**
*
* ```ts
* // if "/foo/bar.txt" contains the text "hello world":
* using file = Deno.openSync("/foo/bar.txt");
* const buf = new Uint8Array(100);
* const numberOfBytesRead = Deno.readSync(file.rid, buf); // 11 bytes
* const text = new TextDecoder().decode(buf); // "hello world"
* ```
*
* @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 readSync(rid: number, buffer: Uint8Array): number | null;

/** Write to the resource ID (`rid`) the contents of the array buffer (`data`).
*
* Resolves to the number of bytes written. This function is one of the lowest
Expand Down
16 changes: 0 additions & 16 deletions runtime/js/90_deno_ns.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,6 @@ const denoNs = {
writeAllSync: buffer.writeAllSync,
copy: io.copy,
SeekMode: io.SeekMode,
read(rid, buffer) {
internals.warnOnDeprecatedApi(
"Deno.read()",
new Error().stack,
"Use `reader.read()` instead.",
);
return io.read(rid, buffer);
},
readSync(rid, buffer) {
internals.warnOnDeprecatedApi(
"Deno.readSync()",
new Error().stack,
"Use `reader.readSync()` instead.",
);
return io.readSync(rid, buffer);
},
write(rid, data) {
internals.warnOnDeprecatedApi(
"Deno.write()",
Expand Down
4 changes: 0 additions & 4 deletions runtime/js/99_main.js
Original file line number Diff line number Diff line change
Expand Up @@ -811,8 +811,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
delete Deno.funlockSync;
delete Deno.readAll;
delete Deno.readAllSync;
delete Deno.read;
delete Deno.readSync;
delete Deno.seek;
delete Deno.seekSync;
delete Deno.writeAll;
Expand Down Expand Up @@ -988,8 +986,6 @@ function bootstrapWorkerRuntime(
delete Deno.funlockSync;
delete Deno.readAll;
delete Deno.readAllSync;
delete Deno.read;
delete Deno.readSync;
delete Deno.seek;
delete Deno.seekSync;
delete Deno.writeAll;
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ console.log("Deno.funlock is", Deno.funlock);
console.log("Deno.funlockSync is", Deno.funlockSync);
console.log("Deno.readAll is", Deno.readAll);
console.log("Deno.readAllSync is", Deno.readAllSync);
console.log("Deno.read is", Deno.read);
console.log("Deno.readSync is", Deno.readSync);
console.log("Deno.seek is", Deno.seek);
console.log("Deno.seekSync is", Deno.seekSync);
console.log("Deno.writeAll is", Deno.writeAll);
Expand Down
2 changes: 0 additions & 2 deletions tests/specs/future/runtime_api/main.out
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ Deno.funlock is undefined
Deno.funlockSync is undefined
Deno.readAll is undefined
Deno.readAllSync is undefined
Deno.read is undefined
Deno.readSync is undefined
Deno.seek is undefined
Deno.seekSync is undefined
Deno.writeAll is undefined
Expand Down
Loading