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