summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_common.ts
blob: 4de0899ea7e8bbb7c12dfc34b79c9182aa675f0e (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.
export interface FileOptions {
  encoding?: string;
  mode?: number;
  flag?: string;
}

export function isFileOptions(
  fileOptions: string | FileOptions | undefined
): fileOptions is FileOptions {
  if (!fileOptions) return false;

  return (
    (fileOptions as FileOptions).encoding != undefined ||
    (fileOptions as FileOptions).flag != undefined ||
    (fileOptions as FileOptions).mode != undefined
  );
}