BlobResponse
DTO returned by RequestBuilder.fetchBlob. Pairs a binary payload with the resolved filename, ready to be handed to a download helper.
Importing
ts
import { BlobResponse } from '@basmilius/http-client';Constructor
ts
new BlobResponse(blob: Blob, name: string)| Argument | Type | Description |
|---|---|---|
blob | Blob | The binary payload from the API. |
name | string | The filename suggested by the API. |
Properties
blob—Blob. Read-only. The binary payload.name—string. Read-only. Filename derived from theContent-Dispositionheader, or adownload-yyyy-MM-dd HH-mm-sstimestamp fallback.
Methods
BlobResponse is decorated with @dto and therefore exposes clone(), fill() and toJSON() from the DTO machinery.
Example
ts
import { downloadBlob } from '@basmilius/utils';
const result = await this
.request('/exports/users.csv')
.method('get')
.bearerToken()
.fetchBlob();
downloadBlob(result.blob, result.name);