summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_close.ts
blob: 8e9a1f62030fddee52848855cc392d94e2565902 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// 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 {
  queueMicrotask(() => {
    try {
      Deno.close(fd);
      callback(null);
    } catch (err) {
      callback(err);
    }
  });
}

export function closeSync(fd: number): void {
  Deno.close(fd);
}