@ffmpeg/util
Functions
downloadWithProgress
▸ downloadWithProgress(url, cb?): Promise<ArrayBuffer>
Download content of a URL with progress.
Progress only works when Content-Length is provided by the server.
Parameters
| Name | Type | 
|---|---|
url | string | URL | 
cb? | ProgressCallback | 
Returns
Promise<ArrayBuffer>
Defined in
fetchFile
▸ fetchFile(file?): Promise<Uint8Array>
An util function to fetch data from url string, base64, URL, File or Blob format.
Examples:
// URL
await fetchFile("http://localhost:3000/video.mp4");
// base64
await fetchFile("data:<type>;base64,wL2dvYWwgbW9yZ...");
// URL
await fetchFile(new URL("video.mp4", import.meta.url));
// File
fileInput.addEventListener('change', (e) => {
  await fetchFile(e.target.files[0]);
});
// Blob
const blob = new Blob(...);
await fetchFile(blob);
Parameters
| Name | Type | 
|---|---|
file? | string | Blob | File | 
Returns
Promise<Uint8Array>
Defined in
importScript
▸ importScript(url): Promise<void>
importScript dynamically import a script, useful when you want to use different versions of ffmpeg.wasm based on environment.
Example:
await importScript("http://localhost:3000/ffmpeg.js");
Parameters
| Name | Type | 
|---|---|
url | string | 
Returns
Promise<void>
Defined in
toBlobURL
▸ toBlobURL(url, mimeType, progress?, cb?): Promise<string>
toBlobURL fetches data from an URL and return a blob URL.
Example:
await toBlobURL("http://localhost:3000/ffmpeg.js", "text/javascript");
Parameters
| Name | Type | Default value | 
|---|---|---|
url | string | undefined | 
mimeType | string | undefined | 
progress | boolean | false | 
cb? | ProgressCallback | undefined | 
Returns
Promise<string>