summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_close.ts
blob: 1b5393db0dbf2d166ca93305940f61e09430a7e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright 2018-2020 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);
}