Skip to content

Home > robinson > downloadByUrl

downloadByUrl() 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.

通过URL下载图片到本地

Signature:

typescript
declare function downloadByUrl(url: string, filename?: string, type?: string): void;
declare function downloadByUrl(url: string, filename?: string, type?: string): void;

Parameters

ParameterTypeDescription
urlstring图片路径
filenamestring(Optional) 下载后的文件名
typestring(Optional) 下载后的文件类型

Returns:

void

Example

downloadByUrl('https://example.com/image.png', 'example.png');

Released under the MIT License.