source: node_modules/undici/types/readable.d.ts

main
Last change on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.6 KB
Line 
1import { Readable } from "stream";
2import { Blob } from 'buffer'
3
4export default BodyReadable
5
6declare class BodyReadable extends Readable {
7 constructor(
8 resume?: (this: Readable, size: number) => void | null,
9 abort?: () => void | null,
10 contentType?: string
11 )
12
13 /** Consumes and returns the body as a string
14 * https://fetch.spec.whatwg.org/#dom-body-text
15 */
16 text(): Promise<string>
17
18 /** Consumes and returns the body as a JavaScript Object
19 * https://fetch.spec.whatwg.org/#dom-body-json
20 */
21 json(): Promise<unknown>
22
23 /** Consumes and returns the body as a Blob
24 * https://fetch.spec.whatwg.org/#dom-body-blob
25 */
26 blob(): Promise<Blob>
27
28 /** Consumes and returns the body as an ArrayBuffer
29 * https://fetch.spec.whatwg.org/#dom-body-arraybuffer
30 */
31 arrayBuffer(): Promise<ArrayBuffer>
32
33 /** Not implemented
34 *
35 * https://fetch.spec.whatwg.org/#dom-body-formdata
36 */
37 formData(): Promise<never>
38
39 /** Returns true if the body is not null and the body has been consumed
40 *
41 * Otherwise, returns false
42 *
43 * https://fetch.spec.whatwg.org/#dom-body-bodyused
44 */
45 readonly bodyUsed: boolean
46
47 /** Throws on node 16.6.0
48 *
49 * If body is null, it should return null as the body
50 *
51 * If body is not null, should return the body as a ReadableStream
52 *
53 * https://fetch.spec.whatwg.org/#dom-body-body
54 */
55 readonly body: never | undefined
56
57 /** Dumps the response body by reading `limit` number of bytes.
58 * @param opts.limit Number of bytes to read (optional) - Default: 262144
59 */
60 dump(opts?: { limit: number }): Promise<void>
61}
Note: See TracBrowser for help on using the repository browser.