summaryrefslogtreecommitdiff
path: root/std/node/_fs/_fs_common.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/node/_fs/_fs_common.ts')
-rw-r--r--std/node/_fs/_fs_common.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/std/node/_fs/_fs_common.ts b/std/node/_fs/_fs_common.ts
new file mode 100644
index 000000000..4de0899ea
--- /dev/null
+++ b/std/node/_fs/_fs_common.ts
@@ -0,0 +1,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
+ );
+}