forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadable.d.ts
More file actions
68 lines (57 loc) · 1.87 KB
/
Copy pathreadable.d.ts
File metadata and controls
68 lines (57 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import { Readable } from 'node:stream'
import { Blob } from 'node:buffer'
export default BodyReadable
declare class BodyReadable extends Readable {
constructor (opts: {
resume: (this: Readable, size: number) => void | null;
abort: () => void | null;
contentType?: string;
contentLength?: number;
highWaterMark?: number;
})
/** Consumes and returns the body as a string
* https://fetch.spec.whatwg.org/#dom-body-text
*/
text (): Promise<string>
/** Consumes and returns the body as a JavaScript Object
* https://fetch.spec.whatwg.org/#dom-body-json
*/
json (): Promise<unknown>
/** Consumes and returns the body as a Blob
* https://fetch.spec.whatwg.org/#dom-body-blob
*/
blob (): Promise<Blob>
/** Consumes and returns the body as an Uint8Array
* https://fetch.spec.whatwg.org/#dom-body-bytes
*/
bytes (): Promise<Uint8Array>
/** Consumes and returns the body as an ArrayBuffer
* https://fetch.spec.whatwg.org/#dom-body-arraybuffer
*/
arrayBuffer (): Promise<ArrayBuffer>
/** Not implemented
*
* https://fetch.spec.whatwg.org/#dom-body-formdata
*/
formData (): Promise<never>
/** Returns true if the body is not null and the body has been consumed
*
* Otherwise, returns false
*
* https://fetch.spec.whatwg.org/#dom-body-bodyused
*/
readonly bodyUsed: boolean
/**
* If body is null, it should return null as the body
*
* If body is not null, should return the body as a ReadableStream
*
* https://fetch.spec.whatwg.org/#dom-body-body
*/
readonly body: never | undefined
/** Dumps the response body by reading `limit` number of bytes.
* @param opts.limit Number of bytes to read (optional) - Default: 131072
* @param opts.signal AbortSignal to cancel the operation (optional)
*/
dump (opts?: { limit: number; signal?: AbortSignal }): Promise<void>
}