@soga/mp4box 1.0.8 → 1.3.6
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 +11 -11
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e,t=Object.create,s=Object.defineProperty,a=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,o=(e,t,i,o)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let c of r(t))n.call(e,c)||c===i||s(e,c,{get:()=>t[c],enumerable:!(o=a(t,c))||o.enumerable});return e},c={};((e,t)=>{for(var a in t)s(e,a,{get:t[a],enumerable:!0})})(c,{getMp4boxInfo:()=>f}),module.exports=(e=c,o(s({},"__esModule",{value:!0}),e));var u=class extends Error{rewritable;message;stack;details;cause;constructor(e){super(e.message),this.rewritable=e.rewritable||!1,this.message=e.message||"",this.details=e.detail?[e.detail]:this.message?[this.message]:[],this.stack=e.stack,this.name="DError",this.cause=e.cause}toJson(){return{name:this.name,message:this.message,stack:this.stack,details:this.details,cause:this.cause}}toString(){const e=this.toJson();return JSON.stringify(e,null,2)}},l=(e,t={})=>{if(e instanceof u){if(!e.rewritable)return e;t.message&&(e.message=t.message);const s=t.detail||t.message;return s&&(e.details=e.details?[s,...e.details]:[s]),t.stack&&(e.stack=`${t.stack}\n${e.stack}`),t.cause?e.cause=t.cause:e.cause&&(e.cause=e.cause),e}{const s=new u({message:e.message,stack:e.stack});t.message&&(s.message=t.message);const a=t.detail||t.message;return a&&(s.details=s.details?[a,...s.details]:[a]),t.stack&&(s.stack=`${t.stack}\n${s.stack}`),t.cause?s.cause=t.cause:e.cause&&(s.cause=e.cause),void 0!==t.rewritable&&(s.rewritable=t.rewritable),s}},d=require("fs-extra"),m=((e,a,r)=>(r=null!=e?t(i(e)):{},o(!a&&e&&e.__esModule?r:s(r,"default",{value:e,enumerable:!0}),e)))(require("mp4box"));async function f(e){try{const t=await new Promise((t,s)=>{const a=m.createFile();let r=0;const i=(0,d.createReadStream)(e,{highWaterMark:41943040});i.on("data",e=>{const t=new Uint8Array(e).buffer;t.fileStart=r,r+=e.byteLength,a.appendBuffer(t)}),i.on("end",()=>{a.flush()}),i.on("error",e=>{s(e)}),a.onError=function(e,t){i.destroy(),a.flush(),s(new Error(t))},a.onReady=function(e){i.destroy(),a.flush(),t(e)}}),s=t.tracks.filter(e=>!!e.audio||"SoundHandler"==e.name),a=t.tracks.filter(e=>!!e.video||"VideoHandler"==e.name);return{duration:t.duration,mime:t.mime,audios:s,videos:a}}catch(t){throw l(t,{message:"Failed to get mp4box info",detail:`Failed to get mp4box info: ${e}`})}}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
var e=class extends Error{rewritable;message;stack;details;cause;constructor(e){super(e.message),this.rewritable=e.rewritable||!1,this.message=e.message||"",this.details=e.detail?[e.detail]:this.message?[this.message]:[],this.stack=e.stack,this.name="DError",this.cause=e.cause}toJson(){return{name:this.name,message:this.message,stack:this.stack,details:this.details,cause:this.cause}}toString(){const e=this.toJson();return JSON.stringify(e,null,2)}};import{createReadStream as s}from"fs-extra";import*as a from"mp4box";async function t(t){try{const e=await new Promise((e,r)=>{const i=a.createFile();let n=0;const o=s(t,{highWaterMark:41943040});o.on("data",e=>{const s=new Uint8Array(e).buffer;s.fileStart=n,n+=e.byteLength,i.appendBuffer(s)}),o.on("end",()=>{i.flush()}),o.on("error",e=>{r(e)}),i.onError=function(e,s){o.destroy(),i.flush(),r(new Error(s))},i.onReady=function(s){o.destroy(),i.flush(),e(s)}}),r=e.tracks.filter(e=>!!e.audio||"SoundHandler"==e.name),i=e.tracks.filter(e=>!!e.video||"VideoHandler"==e.name);return{duration:e.duration,mime:e.mime,audios:r,videos:i}}catch(s){throw((s,a={})=>{if(s instanceof e){if(!s.rewritable)return s;a.message&&(s.message=a.message);const e=a.detail||a.message;return e&&(s.details=s.details?[e,...s.details]:[e]),a.stack&&(s.stack=`${a.stack}\n${s.stack}`),a.cause?s.cause=a.cause:s.cause&&(s.cause=s.cause),s}{const t=new e({message:s.message,stack:s.stack});a.message&&(t.message=a.message);const r=a.detail||a.message;return r&&(t.details=t.details?[r,...t.details]:[r]),a.stack&&(t.stack=`${a.stack}\n${t.stack}`),a.cause?t.cause=a.cause:s.cause&&(t.cause=s.cause),void 0!==a.rewritable&&(t.rewritable=a.rewritable),t}})(s,{message:"Failed to get mp4box info",detail:`Failed to get mp4box info: ${t}`})}}export{t as getMp4boxInfo};
|
package/package.json
CHANGED
|
@@ -3,15 +3,10 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.3.6",
|
|
7
7
|
"main": "./dist/index.js",
|
|
8
8
|
"module": "./dist/index.mjs",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"demo": "tsx ./demo/demo.ts",
|
|
12
|
-
"build": "rimraf dist && tsup src/index.ts --format cjs,esm --dts --minify terser",
|
|
13
|
-
"prepublishOnly": "npm run build"
|
|
14
|
-
},
|
|
15
10
|
"files": [
|
|
16
11
|
"dist"
|
|
17
12
|
],
|
|
@@ -20,15 +15,20 @@
|
|
|
20
15
|
"license": "ISC",
|
|
21
16
|
"description": "",
|
|
22
17
|
"dependencies": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
18
|
+
"fs-extra": "^11.3.2",
|
|
19
|
+
"mp4box": "^1.4.4",
|
|
20
|
+
"@soga/error": "^1.3.6"
|
|
26
21
|
},
|
|
27
22
|
"devDependencies": {
|
|
28
23
|
"@types/fs-extra": "^11.0.4",
|
|
29
24
|
"rimraf": "^6.0.1",
|
|
30
25
|
"terser": "^5.43.1",
|
|
31
26
|
"tsup": "^8.5.0",
|
|
32
|
-
"tsx": "^4.20.
|
|
27
|
+
"tsx": "^4.20.6",
|
|
28
|
+
"@soga/typescript-config": "^1.3.6"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"demo": "tsx ./demo/demo.ts",
|
|
32
|
+
"build": "rimraf dist && tsup src/index.ts --format cjs,esm --dts --minify terser"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|