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