mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
parent
e49d80e500
commit
259752537f
6 changed files with 0 additions and 51 deletions
27
cli/tsc/dts/lib.deno.ns.d.ts
vendored
27
cli/tsc/dts/lib.deno.ns.d.ts
vendored
|
@ -2265,33 +2265,6 @@ declare namespace Deno {
|
|||
*/
|
||||
export function fdatasyncSync(rid: number): void;
|
||||
|
||||
/** Close the given resource ID (`rid`) which has been previously opened, such
|
||||
* as via opening or creating a file. Closing a file when you are finished
|
||||
* with it is important to avoid leaking resources.
|
||||
*
|
||||
* ```ts
|
||||
* const file = await Deno.open("my_file.txt");
|
||||
* // do work with "file" object
|
||||
* Deno.close(file.rid);
|
||||
* ```
|
||||
*
|
||||
* It is recommended to define the variable with the `using` keyword so the
|
||||
* runtime will automatically close the resource when it goes out of scope.
|
||||
* Doing so negates the need to manually close the resource.
|
||||
*
|
||||
* ```ts
|
||||
* using file = await Deno.open("my_file.txt");
|
||||
* // do work with "file" object
|
||||
* ```
|
||||
*
|
||||
* @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 close(rid: number): void;
|
||||
|
||||
/** The Deno abstraction for reading and writing files.
|
||||
*
|
||||
* This is the most straight forward way of handling files within Deno and is
|
||||
|
|
|
@ -518,14 +518,6 @@ const internalSymbol = Symbol("Deno.internal");
|
|||
const finalDenoNs = {
|
||||
internal: internalSymbol,
|
||||
[internalSymbol]: internals,
|
||||
close(rid) {
|
||||
internals.warnOnDeprecatedApi(
|
||||
"Deno.close()",
|
||||
new Error().stack,
|
||||
"Use `closer.close()` instead.",
|
||||
);
|
||||
core.close(rid);
|
||||
},
|
||||
...denoNs,
|
||||
// Deno.test and Deno.bench are noops here, but kept for compatibility; so
|
||||
// that they don't cause errors when used outside of `deno test`/`deno bench`
|
||||
|
@ -822,7 +814,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) {
|
|||
if (future) {
|
||||
delete globalThis.window;
|
||||
delete Deno.Buffer;
|
||||
delete Deno.close;
|
||||
delete Deno.copy;
|
||||
delete Deno.File;
|
||||
delete Deno.fstat;
|
||||
|
@ -1005,7 +996,6 @@ function bootstrapWorkerRuntime(
|
|||
|
||||
if (future) {
|
||||
delete Deno.Buffer;
|
||||
delete Deno.close;
|
||||
delete Deno.copy;
|
||||
delete Deno.File;
|
||||
delete Deno.fstat;
|
||||
|
|
|
@ -78,7 +78,6 @@ util::unit_test_factory!(
|
|||
remove_test,
|
||||
rename_test,
|
||||
request_test,
|
||||
resources_test,
|
||||
response_test,
|
||||
serve_test,
|
||||
signal_test,
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
console.log("window is", globalThis.window);
|
||||
console.log("Deno.Buffer is", Deno.Buffer);
|
||||
console.log("Deno.close is", Deno.close);
|
||||
console.log("Deno.copy is", Deno.copy);
|
||||
console.log("Deno.File is", Deno.File);
|
||||
console.log("Deno.fstat is", Deno.fstat);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
window is undefined
|
||||
Deno.Buffer is undefined
|
||||
Deno.close is undefined
|
||||
Deno.copy is undefined
|
||||
Deno.File is undefined
|
||||
Deno.fstat is undefined
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
||||
|
||||
// deno-lint-ignore-file no-deprecated-deno-api
|
||||
|
||||
import { assertThrows } from "./test_util.ts";
|
||||
|
||||
Deno.test(function resourcesCloseBadArgs() {
|
||||
assertThrows(() => {
|
||||
Deno.close((null as unknown) as number);
|
||||
}, TypeError);
|
||||
});
|
Loading…
Reference in a new issue