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

18 lines
424 B
TypeScript

// 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);
}