2020-03-14 23:01:34 -04:00
|
|
|
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
2020-07-08 05:26:39 -04:00
|
|
|
import type { CallbackWithError } from "./_fs_common.ts";
|
2020-03-14 23:01:34 -04:00
|
|
|
|
|
|
|
export function close(fd: number, callback: CallbackWithError): void {
|
2020-05-19 19:01:06 -04:00
|
|
|
queueMicrotask(() => {
|
2020-03-14 23:01:34 -04:00
|
|
|
try {
|
|
|
|
Deno.close(fd);
|
2020-05-19 19:01:06 -04:00
|
|
|
callback(null);
|
2020-03-14 23:01:34 -04:00
|
|
|
} catch (err) {
|
|
|
|
callback(err);
|
2020-05-19 19:01:06 -04:00
|
|
|
}
|
|
|
|
});
|
2020-03-14 23:01:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export function closeSync(fd: number): void {
|
|
|
|
Deno.close(fd);
|
|
|
|
}
|