Deno.close
close
-
close(rid: number): void
-
使用给定的资源 ID (rid) 来关闭先前创建或打开的文件。 为避免资源泄露,事关重大,文件应当用完即关。
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"); // 与 "file" 对象一起使用 Deno.close(file.rid);
参数
- ##### rid: number