1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-08 07:08:27 -05:00
denoland-deno/std/node/_fs/_fs_close.ts

19 lines
424 B
TypeScript
Raw Normal View History

2021-01-10 21:59:07 -05:00
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import type { CallbackWithError } from "./_fs_common.ts";
export function close(fd: number, callback: CallbackWithError): void {
setTimeout(() => {
let error = null;
try {
Deno.close(fd);
} catch (err) {
error = err;
}
callback(error);
}, 0);
}
export function closeSync(fd: number): void {
Deno.close(fd);
}