@soga/mp4box 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,r=Object.create,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,a=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,u=(e,r,a,u)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of n(r))i.call(e,l)||l===a||t(e,l,{get:()=>r[l],enumerable:!(u=o(r,l))||u.enumerable});return e},l={};((e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})})(l,{getMp4boxInfo:()=>d}),module.exports=(e=l,u(t({},"__esModule",{value:!0}),e));var
|
|
1
|
+
"use strict";var e,r=Object.create,t=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,a=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,u=(e,r,a,u)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of n(r))i.call(e,l)||l===a||t(e,l,{get:()=>r[l],enumerable:!(u=o(r,l))||u.enumerable});return e},l={};((e,r)=>{for(var o in r)t(e,o,{get:r[o],enumerable:!0})})(l,{getMp4boxInfo:()=>d}),module.exports=(e=l,u(t({},"__esModule",{value:!0}),e));var f=require("@soga/error"),s=require("fs-extra"),c=((e,o,n)=>(n=null!=e?r(a(e)):{},u(!o&&e&&e.__esModule?n:t(n,"default",{value:e,enumerable:!0}),e)))(require("mp4box"));async function d(e){try{const r=await new Promise((r,t)=>{const o=c.createFile();let n=0;const a=(0,s.createReadStream)(e,{highWaterMark:41943040});a.on("data",e=>{const r=new Uint8Array(e).buffer;r.fileStart=n,n+=e.byteLength,o.appendBuffer(r)}),a.on("end",()=>{o.flush()}),a.on("error",e=>{t(e)}),o.onError=function(e,r){a.destroy(),o.flush(),t(new Error(r))},o.onReady=function(e){a.destroy(),o.flush(),r(e)}}),t=r.tracks.filter(e=>!!e.audio||"SoundHandler"==e.name),o=r.tracks.filter(e=>!!e.video||"VideoHandler"==e.name);return{duration:r.duration,mime:r.mime,audios:t,videos:o}}catch(r){throw(0,f.buildDError)(r,{message:"Failed to get mp4box info",detail:`Failed to get mp4box info: ${e}`})}}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{buildDError as
|
|
1
|
+
import{buildDError as o}from"@soga/error";import{createReadStream as r}from"fs-extra";import*as e from"mp4box";async function t(t){try{const o=await new Promise((o,n)=>{const a=e.createFile();let i=0;const s=r(t,{highWaterMark:41943040});s.on("data",o=>{const r=new Uint8Array(o).buffer;r.fileStart=i,i+=o.byteLength,a.appendBuffer(r)}),s.on("end",()=>{a.flush()}),s.on("error",o=>{n(o)}),a.onError=function(o,r){s.destroy(),a.flush(),n(new Error(r))},a.onReady=function(r){s.destroy(),a.flush(),o(r)}}),n=o.tracks.filter(o=>!!o.audio||"SoundHandler"==o.name),a=o.tracks.filter(o=>!!o.video||"VideoHandler"==o.name);return{duration:o.duration,mime:o.mime,audios:n,videos:a}}catch(r){throw o(r,{message:"Failed to get mp4box info",detail:`Failed to get mp4box info: ${t}`})}}export{t as getMp4boxInfo};
|