summaryrefslogtreecommitdiff
path: root/cli/dts/lib.deno.ns.d.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-02-15 13:59:04 +0100
committerGitHub <noreply@github.com>2022-02-15 13:59:04 +0100
commit9b5e336c3d9b9c9d3b520ddb2ff80502b155ed3f (patch)
treea07abb2c69bcb0b2fd941a446675b82818725340 /cli/dts/lib.deno.ns.d.ts
parentbdc8006a362b4f95107a25ca816dcdedb7f44e4a (diff)
feat: Add Deno.FsFile, deprecate Deno.File (#13660)
Diffstat (limited to 'cli/dts/lib.deno.ns.d.ts')
-rw-r--r--cli/dts/lib.deno.ns.d.ts45
1 files changed, 37 insertions, 8 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts
index ff8fbb741..70dd5f4bc 100644
--- a/cli/dts/lib.deno.ns.d.ts
+++ b/cli/dts/lib.deno.ns.d.ts
@@ -795,7 +795,7 @@ declare namespace Deno {
},
): IterableIterator<Uint8Array>;
- /** Synchronously open a file and return an instance of `Deno.File`. The
+ /** Synchronously open a file and return an instance of `Deno.FsFile`. The
* file does not need to previously exist if using the `create` or `createNew`
* open options. It is the callers responsibility to close the file when finished
* with it.
@@ -808,9 +808,9 @@ declare namespace Deno {
*
* Requires `allow-read` and/or `allow-write` permissions depending on options.
*/
- export function openSync(path: string | URL, options?: OpenOptions): File;
+ export function openSync(path: string | URL, options?: OpenOptions): FsFile;
- /** Open a file and resolve to an instance of `Deno.File`. The
+ /** Open a file and resolve to an instance of `Deno.FsFile`. The
* file does not need to previously exist if using the `create` or `createNew`
* open options. It is the callers responsibility to close the file when finished
* with it.
@@ -826,10 +826,10 @@ declare namespace Deno {
export function open(
path: string | URL,
options?: OpenOptions,
- ): Promise<File>;
+ ): Promise<FsFile>;
/** Creates a file if none exists or truncates an existing file and returns
- * an instance of `Deno.File`.
+ * an instance of `Deno.FsFile`.
*
* ```ts
* const file = Deno.createSync("/foo/bar.txt");
@@ -837,10 +837,10 @@ declare namespace Deno {
*
* Requires `allow-read` and `allow-write` permissions.
*/
- export function createSync(path: string | URL): File;
+ export function createSync(path: string | URL): FsFile;
/** Creates a file if none exists or truncates an existing file and resolves to
- * an instance of `Deno.File`.
+ * an instance of `Deno.FsFile`.
*
* ```ts
* const file = await Deno.create("/foo/bar.txt");
@@ -848,7 +848,7 @@ declare namespace Deno {
*
* Requires `allow-read` and `allow-write` permissions.
*/
- export function create(path: string | URL): Promise<File>;
+ export function create(path: string | URL): Promise<FsFile>;
/** Synchronously read from a resource ID (`rid`) into an array buffer (`buffer`).
*
@@ -1070,6 +1070,35 @@ declare namespace Deno {
export function close(rid: number): void;
/** The Deno abstraction for reading and writing files. */
+ export class FsFile
+ implements
+ Reader,
+ ReaderSync,
+ Writer,
+ WriterSync,
+ Seeker,
+ SeekerSync,
+ Closer {
+ readonly rid: number;
+ constructor(rid: number);
+ write(p: Uint8Array): Promise<number>;
+ writeSync(p: Uint8Array): number;
+ truncate(len?: number): Promise<void>;
+ truncateSync(len?: number): void;
+ read(p: Uint8Array): Promise<number | null>;
+ readSync(p: Uint8Array): number | null;
+ seek(offset: number, whence: SeekMode): Promise<number>;
+ seekSync(offset: number, whence: SeekMode): number;
+ stat(): Promise<FileInfo>;
+ statSync(): FileInfo;
+ close(): void;
+ }
+
+ /**
+ * @deprecated Use `Deno.FsFile` instead. `Deno.File` will be removed in Deno 2.0.
+ *
+ * The Deno abstraction for reading and writing files.
+ */
export class File
implements
Reader,