mirror of
https://github.com/denoland/deno.git
synced 2024-11-29 16:30:56 -05:00
Remove __io namespace (#4669)
This commit is contained in:
parent
f07fcfcc80
commit
b4836be57e
1 changed files with 1 additions and 94 deletions
95
cli/js/lib.deno.shared_globals.d.ts
vendored
95
cli/js/lib.deno.shared_globals.d.ts
vendored
|
@ -1191,105 +1191,12 @@ declare namespace __eventTarget {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare namespace __io {
|
|
||||||
/** UNSTABLE: maybe remove "SEEK_" prefix. Maybe capitalization wrong. */
|
|
||||||
export enum SeekMode {
|
|
||||||
SEEK_START = 0,
|
|
||||||
SEEK_CURRENT = 1,
|
|
||||||
SEEK_END = 2,
|
|
||||||
}
|
|
||||||
export interface Reader {
|
|
||||||
/** Reads up to p.byteLength bytes into `p`. It resolves to the number
|
|
||||||
* of bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error encountered.
|
|
||||||
* Even if `read()` returns `n` < `p.byteLength`, it may use all of `p` as
|
|
||||||
* scratch space during the call. If some data is available but not
|
|
||||||
* `p.byteLength` bytes, `read()` conventionally returns what is available
|
|
||||||
* instead of waiting for more.
|
|
||||||
*
|
|
||||||
* When `read()` encounters end-of-file condition, it returns EOF symbol.
|
|
||||||
*
|
|
||||||
* When `read()` encounters an error, it rejects with an error.
|
|
||||||
*
|
|
||||||
* Callers should always process the `n` > `0` bytes returned before
|
|
||||||
* considering the EOF. Doing so correctly handles I/O errors that happen
|
|
||||||
* after reading some bytes and also both of the allowed EOF behaviors.
|
|
||||||
*
|
|
||||||
* Implementations must not retain `p`.
|
|
||||||
*/
|
|
||||||
read(p: Uint8Array): Promise<number | Deno.EOF>;
|
|
||||||
}
|
|
||||||
export interface SyncReader {
|
|
||||||
readSync(p: Uint8Array): number | Deno.EOF;
|
|
||||||
}
|
|
||||||
export interface Writer {
|
|
||||||
/** Writes `p.byteLength` bytes from `p` to the underlying data
|
|
||||||
* stream. It resolves to the number of bytes written from `p` (`0` <= `n` <=
|
|
||||||
* `p.byteLength`) and any error encountered that caused the write to stop
|
|
||||||
* early. `write()` must return a non-null error if it returns `n` <
|
|
||||||
* `p.byteLength`. write() must not modify the slice data, even temporarily.
|
|
||||||
*
|
|
||||||
* Implementations must not retain `p`.
|
|
||||||
*/
|
|
||||||
write(p: Uint8Array): Promise<number>;
|
|
||||||
}
|
|
||||||
export interface SyncWriter {
|
|
||||||
writeSync(p: Uint8Array): number;
|
|
||||||
}
|
|
||||||
export interface Closer {
|
|
||||||
close(): void;
|
|
||||||
}
|
|
||||||
export interface Seeker {
|
|
||||||
/** Seek sets the offset for the next `read()` or `write()` to offset,
|
|
||||||
* interpreted according to `whence`: `SEEK_START` means relative to the
|
|
||||||
* start of the file, `SEEK_CURRENT` means relative to the current offset,
|
|
||||||
* and `SEEK_END` means relative to the end. Seek returns the new offset
|
|
||||||
* relative to the start of the file and an error, if any.
|
|
||||||
*
|
|
||||||
* Seeking to an offset before the start of the file is an error. Seeking to
|
|
||||||
* any positive offset is legal, but the behavior of subsequent I/O operations
|
|
||||||
* on the underlying object is implementation-dependent.
|
|
||||||
* It returns the cursor position.
|
|
||||||
*/
|
|
||||||
seek(offset: number, whence: SeekMode): Promise<number>;
|
|
||||||
}
|
|
||||||
export interface SyncSeeker {
|
|
||||||
seekSync(offset: number, whence: SeekMode): number;
|
|
||||||
}
|
|
||||||
export interface ReadCloser extends Reader, Closer {}
|
|
||||||
export interface WriteCloser extends Writer, Closer {}
|
|
||||||
export interface ReadSeeker extends Reader, Seeker {}
|
|
||||||
export interface WriteSeeker extends Writer, Seeker {}
|
|
||||||
export interface ReadWriteCloser extends Reader, Writer, Closer {}
|
|
||||||
export interface ReadWriteSeeker extends Reader, Writer, Seeker {}
|
|
||||||
|
|
||||||
/** UNSTABLE: controversial.
|
|
||||||
*
|
|
||||||
* Copies from `src` to `dst` until either `EOF` is reached on `src`
|
|
||||||
* or an error occurs. It returns the number of bytes copied and the first
|
|
||||||
* error encountered while copying, if any.
|
|
||||||
*
|
|
||||||
* Because `copy()` is defined to read from `src` until `EOF`, it does not
|
|
||||||
* treat an `EOF` from `read()` as an error to be reported.
|
|
||||||
*/
|
|
||||||
export function copy(dst: Writer, src: Reader): Promise<number>;
|
|
||||||
|
|
||||||
/** UNSTABLE: Make Reader into AsyncIterable? Remove this?
|
|
||||||
*
|
|
||||||
* Turns `r` into async iterator.
|
|
||||||
*
|
|
||||||
* for await (const chunk of toAsyncIterator(reader)) {
|
|
||||||
* console.log(chunk)
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export function toAsyncIterator(r: Reader): AsyncIterableIterator<Uint8Array>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare namespace __fetch {
|
declare namespace __fetch {
|
||||||
class Body
|
class Body
|
||||||
implements
|
implements
|
||||||
__domTypes.Body,
|
__domTypes.Body,
|
||||||
__domTypes.ReadableStream<Uint8Array>,
|
__domTypes.ReadableStream<Uint8Array>,
|
||||||
__io.ReadCloser {
|
Deno.ReadCloser {
|
||||||
readonly contentType: string;
|
readonly contentType: string;
|
||||||
bodyUsed: boolean;
|
bodyUsed: boolean;
|
||||||
readonly locked: boolean;
|
readonly locked: boolean;
|
||||||
|
|
Loading…
Reference in a new issue