Skip to content

Commit

Permalink
Add flow definitions for fsPromise lstat and rm methods
Browse files Browse the repository at this point in the history
Summary:
Add lstat() and rm() fsPromises methods, per:

* https://nodejs.org/docs/latest-v14.x/api/fs.html#fs_fspromises_lstat_path_options
* https://nodejs.org/docs/latest-v14.x/api/fs.html#fs_fspromises_rm_path_options

Reviewed By: panagosg7

Differential Revision: D32495063

fbshipit-source-id: da1059adda0a6e70182a69958bf498f1262dd009
  • Loading branch information
John Ward authored and facebook-github-bot committed Nov 18, 2021
1 parent d9090f0 commit 4cd99d4
Show file tree
Hide file tree
Showing 2 changed files with 252 additions and 249 deletions.
3 changes: 3 additions & 0 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,7 @@ declare module "fs" {
declare type EncodingOptions = { encoding?: string, ... };
declare type EncodingFlag = EncodingOptions & { flag?: string, ... };
declare type WriteOptions = EncodingFlag & { mode?: number, ... };
declare type RemoveOptions = { force?: boolean, maxRetries?: number, recursive?: boolean, retryDelay?: number, ... };
declare class FileHandle {
appendFile(data: string | Buffer, options: WriteOptions | string): Promise<void>;
chmod(mode: number): Promise<void>;
Expand Down Expand Up @@ -1340,6 +1341,7 @@ declare module "fs" {
lchmod(path: FSPromisePath, mode: number): Promise<void>,
lchown(path: FSPromisePath, uid: number, guid: number): Promise<void>,
link(existingPath: FSPromisePath, newPath: FSPromisePath): Promise<void>,
lstat(path: FSPromisePath): Promise<Stats>,
mkdir(path: FSPromisePath, mode?: number | {
recursive?: boolean,
mode?: number,
Expand Down Expand Up @@ -1369,6 +1371,7 @@ declare module "fs" {
& ((path: FSPromisePath, options: BufferEncoding) => Promise<Buffer>)
& ((path: FSPromisePath, options?: string | EncodingOptions) => Promise<string>),
rename(oldPath: FSPromisePath, newPath: FSPromisePath): Promise<void>,
rm(path: FSPromisePath, options?: RemoveOptions): Promise<void>,
rmdir(path: FSPromisePath): Promise<void>,
stat(path: FSPromisePath): Promise<Stats>,
symlink(target: FSPromisePath, path: FSPromisePath, type?: 'dir' | 'file' | 'junction'): Promise<void>,
Expand Down
Loading

0 comments on commit 4cd99d4

Please sign in to comment.