1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-25 00:29:09 -05:00
denoland-deno/std/node/_fs/_fs_common.ts
Chris Knight cabe63eb05
fix: Node polyfill fsAppend rework (#4322)
* My original implementation of `fs.appendFile` used an async API, which, though 
  it would work fine as a polyfill, wasn't an exact match with the Node API.  This PR
  reworks that API to mimic the Node API fully as a synchronous void function with
  an async internal implementation.
* Refactor move of other internal fs `dirent` and `dir` classes to the _fs internal
  directory.
2020-03-12 10:12:27 -04:00

21 lines
548 B
TypeScript

// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
export type CallbackWithError = (err?: Error) => void;
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
);
}