diff options
author | Benjamin Gruenbaum <benjamingr@gmail.com> | 2021-06-22 18:45:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-22 11:45:26 -0400 |
commit | 20b0a5125a80c027f21472eec98f29e5e35629fb (patch) | |
tree | f6551848efdd0c1ae87144e78da4c127b46f51ed /cli/dts/lib.deno.ns.d.ts | |
parent | 9c0b41e24bc5f4ec08c62517f40b74506ac9f0d1 (diff) |
feat(core): support AbortSignal in readFile (#10943)
Diffstat (limited to 'cli/dts/lib.deno.ns.d.ts')
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 8ebf16150..da016db8a 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -861,6 +861,15 @@ declare namespace Deno { mode?: number; } + export interface ReadFileOptions { + /** + * An abort signal to allow cancellation of the file read operation. + * If the signal becomes aborted the readFile operation will be stopped + * and the promise returned will be rejected with an AbortError. + */ + signal?: AbortSignal; + } + /** * * Check if a given resource id (`rid`) is a TTY. @@ -1385,7 +1394,10 @@ declare namespace Deno { * ``` * * Requires `allow-read` permission. */ - export function readTextFile(path: string | URL): Promise<string>; + export function readTextFile( + path: string | URL, + options?: ReadFileOptions, + ): Promise<string>; /** Synchronously reads and returns the entire contents of a file as an array * of bytes. `TextDecoder` can be used to transform the bytes to string if @@ -1411,7 +1423,10 @@ declare namespace Deno { * ``` * * Requires `allow-read` permission. */ - export function readFile(path: string | URL): Promise<Uint8Array>; + export function readFile( + path: string | URL, + options?: ReadFileOptions, + ): Promise<Uint8Array>; /** A FileInfo describes a file and is returned by `stat`, `lstat`, * `statSync`, `lstatSync`. */ |