@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 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 s=require("@soga/error"),c=require("fs-extra"),f=((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=f.createFile();let n=0;const a=(0,c.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,s.buildDError)(r,{message:"Failed to get MP4 box info",detail:`Error while processing file: ${e}`})}}
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 r}from"@soga/error";import{createReadStream as e}from"fs-extra";import*as o from"mp4box";async function t(t){try{const r=await new Promise((r,n)=>{const a=o.createFile();let i=0;const s=e(t,{highWaterMark:41943040});s.on("data",r=>{const e=new Uint8Array(r).buffer;e.fileStart=i,i+=r.byteLength,a.appendBuffer(e)}),s.on("end",()=>{a.flush()}),s.on("error",r=>{n(r)}),a.onError=function(r,e){s.destroy(),a.flush(),n(new Error(e))},a.onReady=function(e){s.destroy(),a.flush(),r(e)}}),n=r.tracks.filter(r=>!!r.audio||"SoundHandler"==r.name),a=r.tracks.filter(r=>!!r.video||"VideoHandler"==r.name);return{duration:r.duration,mime:r.mime,audios:n,videos:a}}catch(e){throw r(e,{message:"Failed to get MP4 box info",detail:`Error while processing file: ${t}`})}}export{t as getMp4boxInfo};
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};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.0.6",
6
+ "version": "1.0.7",
7
7
  "main": "./dist/index.js",
8
8
  "module": "./dist/index.mjs",
9
9
  "types": "./dist/index.d.ts",