Skip to main content
The Deno 2 Release Candidate is here
Learn more
Module

x/deno/cli/js/lib.deno.ns.d.ts>Deno.close

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.close
import { Deno } from "https://deno.land/x/deno@v1.0.0/cli/js/lib.deno.ns.d.ts";
const { close } = Deno;

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.

 const file = await Deno.open("my_file.txt");
 // do work with "file" object
 Deno.close(file.rid);

Parameters

rid: number