Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ffmpeg/ffmpeg

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ffmpeg/ffmpeg - npm Package Compare versions

Comparing version 0.12.2 to 0.12.3

6

dist/esm/classes.d.ts

@@ -37,3 +37,4 @@ import { FSNode, FFMessageLoadConfig, OK, IsFirst, LogEventCallback, ProgressEventCallback, FileData } from "./types.js";

*/
on(event: "log" | "progress", callback: LogEventCallback | ProgressEventCallback): void;
on(event: "log", callback: LogEventCallback): void;
on(event: "progress", callback: ProgressEventCallback): void;
/**

@@ -44,3 +45,4 @@ * Unlisten to log or prgress events from `ffmpeg.exec()`.

*/
off(event: "log" | "progress", callback: LogEventCallback | ProgressEventCallback): void;
off(event: "log", callback: LogEventCallback): void;
off(event: "progress", callback: ProgressEventCallback): void;
/**

@@ -47,0 +49,0 @@ * Loads ffmpeg-core inside web worker. It is required to call this method first

@@ -73,26 +73,2 @@ import { FFMessageType } from "./const.js";

};
/**
* Listen to log or prgress events from `ffmpeg.exec()`.
*
* @example
* ```ts
* ffmpeg.on("log", ({ type, message }) => {
* // ...
* })
* ```
*
* @example
* ```ts
* ffmpeg.on("progress", ({ progress, time }) => {
* // ...
* })
* ```
*
* @remarks
* - log includes output to stdout and stderr.
* - The progress events are accurate only when the length of
* input and output video/audio file are the same.
*
* @category FFmpeg
*/
on(event, callback) {

@@ -106,7 +82,2 @@ if (event === "log") {

}
/**
* Unlisten to log or prgress events from `ffmpeg.exec()`.
*
* @category FFmpeg
*/
off(event, callback) {

@@ -113,0 +84,0 @@ if (event === "log") {

@@ -28,10 +28,4 @@ /// <reference no-default-lib="true" />

// Fix `Overload resolution failed.` when using multi-threaded ffmpeg-core.
mainScriptUrlOrBlob: coreURL,
locateFile: (path, prefix) => {
if (path.endsWith(".wasm"))
return wasmURL;
if (path.endsWith(".worker.js"))
return workerURL;
return prefix + path;
},
// Encoded wasmURL and workerURL in the URL as a hack to fix locateFile issue.
mainScriptUrlOrBlob: `${coreURL}#${btoa(JSON.stringify({ wasmURL, workerURL }))}`,
});

@@ -38,0 +32,0 @@ ffmpeg.setLogger((data) => self.postMessage({ type: FFMessageType.LOG, data }));

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpegWASM=t():e.FFmpegWASM=t()}(self,(()=>(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var s=t[a];if(void 0!==s)return s.exports;var o=t[a]={exports:{}};return e[a](o,o.exports,r),o.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),s=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let o;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!o)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="https://unpkg.com/@ffmpeg/core@0.12.1/dist/umd/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!o,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw s}return o=await self.createFFmpegCore({mainScriptUrlOrBlob:i,locateFile:(e,t)=>e.endsWith(".wasm")?c:e.endsWith(".worker.js")?p:t+e}),o.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),o.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{o.setTimeout(t),o.exec(...e);const r=o.ret;return o.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(o.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>o.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(o.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(o.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(o.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=o.FS.readdir(e),r=[];for(const a of t){const t=o.FS.stat(`${e}/${a}`),s=o.FS.isDir(t.mode);r.push({name:a,isDir:s})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(o.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})()));
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.FFmpegWASM=t():e.FFmpegWASM=t()}(self,(()=>(()=>{var e={454:e=>{function t(e){return Promise.resolve().then((()=>{var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}))}t.keys=()=>[],t.resolve=t,t.id=454,e.exports=t}},t={};function r(a){var o=t[a];if(void 0!==o)return o.exports;var s=t[a]={exports:{}};return e[a](s,s.exports,r),s.exports}return r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e;!function(e){e.LOAD="LOAD",e.EXEC="EXEC",e.WRITE_FILE="WRITE_FILE",e.READ_FILE="READ_FILE",e.DELETE_FILE="DELETE_FILE",e.RENAME="RENAME",e.CREATE_DIR="CREATE_DIR",e.LIST_DIR="LIST_DIR",e.DELETE_DIR="DELETE_DIR",e.ERROR="ERROR",e.DOWNLOAD="DOWNLOAD",e.PROGRESS="PROGRESS",e.LOG="LOG"}(e||(e={}));const t=new Error("unknown message type"),a=new Error("ffmpeg is not loaded, call `await ffmpeg.load()` first"),o=(new Error("called FFmpeg.terminate()"),new Error("failed to import ffmpeg-core.js"));let s;self.onmessage=async({data:{id:E,type:n,data:i}})=>{const c=[];let p;try{if(n!==e.LOAD&&!s)throw a;switch(n){case e.LOAD:p=await(async({coreURL:t="https://unpkg.com/@ffmpeg/core@0.12.1/dist/umd/ffmpeg-core.js",wasmURL:a,workerURL:E})=>{const n=!s,i=t,c=a||t.replace(/.js$/g,".wasm"),p=E||t.replace(/.js$/g,".worker.js");try{importScripts(i)}catch{if(self.createFFmpegCore=(await r(454)(i)).default,!self.createFFmpegCore)throw o}return s=await self.createFFmpegCore({mainScriptUrlOrBlob:`${i}#${btoa(JSON.stringify({wasmURL:c,workerURL:p}))}`}),s.setLogger((t=>self.postMessage({type:e.LOG,data:t}))),s.setProgress((t=>self.postMessage({type:e.PROGRESS,data:t}))),n})(i);break;case e.EXEC:p=(({args:e,timeout:t=-1})=>{s.setTimeout(t),s.exec(...e);const r=s.ret;return s.reset(),r})(i);break;case e.WRITE_FILE:p=(({path:e,data:t})=>(s.FS.writeFile(e,t),!0))(i);break;case e.READ_FILE:p=(({path:e,encoding:t})=>s.FS.readFile(e,{encoding:t}))(i);break;case e.DELETE_FILE:p=(({path:e})=>(s.FS.unlink(e),!0))(i);break;case e.RENAME:p=(({oldPath:e,newPath:t})=>(s.FS.rename(e,t),!0))(i);break;case e.CREATE_DIR:p=(({path:e})=>(s.FS.mkdir(e),!0))(i);break;case e.LIST_DIR:p=(({path:e})=>{const t=s.FS.readdir(e),r=[];for(const a of t){const t=s.FS.stat(`${e}/${a}`),o=s.FS.isDir(t.mode);r.push({name:a,isDir:o})}return r})(i);break;case e.DELETE_DIR:p=(({path:e})=>(s.FS.rmdir(e),!0))(i);break;default:throw t}}catch(t){return void self.postMessage({id:E,type:e.ERROR,data:t})}p instanceof Uint8Array&&c.push(p.buffer),self.postMessage({id:E,type:n,data:p},c)}})(),{}})()));
//# sourceMappingURL=814.ffmpeg.js.map
{
"name": "@ffmpeg/ffmpeg",
"version": "0.12.2",
"version": "0.12.3",
"description": "FFmpeg WebAssembly version for browser",

@@ -57,4 +57,3 @@ "main": "./dist/umd/ffmpeg.js",

"typescript": "^5.1.6",
"webpack-cli": "^5.1.4",
"worker-loader": "^3.0.8"
"webpack-cli": "^5.1.4"
},

@@ -61,0 +60,0 @@ "dependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc