Options
All
  • Public
  • Public/Protected
  • All
Menu

A Download is the result of calling parcel.downloadDocument or document.download().

The downloaded data can be read using async iterable for await (const chunk of download), or by calling await download.pipeTo(sink).

The download may be aborted by calling download.destroy(), as with any Readable.

Hierarchy

  • Download

Implements

  • AsyncIterable<Uint8Array>

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Download(client: KyInstance, endpoint: string): Download
  • Parameters

    • client: KyInstance
    • endpoint: string

    Returns Download

Properties

Private Readonly abortController

abortController: AbortController

Private Optional res

res: Promise<Response>

Accessors

aborted

  • get aborted(): boolean
  • Returns boolean

Methods

[asyncIterator]

  • [asyncIterator](): AsyncIterator<Uint8Array, any, undefined>
  • Returns AsyncIterator<Uint8Array, any, undefined>

abort

  • abort(): void
  • Returns void

Private makeRequest

  • makeRequest(): Promise<Response>
  • Lazily make the request. Helps avoid unhandled promise rejections when the request fails before a pipe or iterator handler is attached.

    Returns Promise<Response>

pipeTo

  • pipeTo(sink: Writable | WriteStream | WritableStream<any>): Promise<void>
  • Convenience method for piping to a sink and waiting for writing to finish. This method must not be used alongside getStream or AsyncIterable.

    Parameters

    • sink: Writable | WriteStream | WritableStream<any>

    Returns Promise<void>

Generated using TypeDoc