Skip to content

Home > robinson > downloadByBlob

downloadByBlob() function

This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

通过Blob对象下载文件

Signature:

typescript
declare function downloadByBlob(blob: BlobPart, fileNm: string, suffix?: string): void;
declare function downloadByBlob(blob: BlobPart, fileNm: string, suffix?: string): void;

Parameters

ParameterTypeDescription
blobBlobPartBlob文件流
fileNmstring下载后的文件名
suffixstring(Optional) 下载后的文件类型,默认为'txt'

Returns:

void

Example

downloadByBlob(new Blob(['Hello, world!'], { type: 'text/plain' }), 'example.txt');

Released under the MIT License.