Skip to content

urlToBlob

Convert URL to Blob.

Usage

js
import { urlToBlob } from 'js-cool'

Signature

typescript
function urlToBlob(url: string): Promise<Blob>

Parameters

ParameterTypeDescription
urlstringURL to fetch

Returns

Promise<Blob> - Blob object.

Examples

js
const blob = await urlToBlob('https://example.com/image.png')

// Use for file download
const blob = await urlToBlob(fileUrl)
const url = URL.createObjectURL(blob)

Released under the MIT License.