mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
cabe63eb05
* 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.
21 lines
548 B
TypeScript
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
|
|
);
|
|
}
|