Comparing version 2.0.1 to 2.0.2
import { Chunk } from './Chunk'; | ||
export declare class IFFTransformStream<T = any> extends TransformStream<Uint8Array, T> { | ||
export declare class IFFTransformStream<T = any> extends TransformStream<ArrayBuffer, T> { | ||
#private; | ||
constructor(transformer?: Transformer<Chunk, T>); | ||
} |
@@ -1,1 +0,1 @@ | ||
"use strict";var T=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var u=(e,t,r)=>(T(e,t,"read from private field"),r?r.call(e):t.get(e)),B=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},g=(e,t,r,n)=>(T(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=4,d=BigUint64Array.BYTES_PER_ELEMENT,f=a+d,U=127;function S(e){if(typeof e!="string")throw new Error("identifier must be string.");if(e.length!==a)throw new Error(`identifier must be ${a} bytes.`);for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>U)throw new Error("identifier must be ASCII characters.")}function p(e){return new TextEncoder().encode(e)}function I(e){const t=new ArrayBuffer(d);return new DataView(t).setBigUint64(0,BigInt(e)),new Uint8Array(t)}function x(e,t){const r=new Uint8Array(f);return r.set(p(e)),r.set(I(t),a),r}class E extends Blob{constructor(t,r,n){S(t),super(r,n),this.identifier=t}}class D extends Blob{constructor(t,r){S(t);const n=new Blob(r),i=x(t,n.size);super([i,n])}}class A extends Array{constructor(...t){super(...t)}blob(){const t=s=>new TextEncoder().encode(s),r=s=>{const w=new ArrayBuffer(d);return new DataView(w).setBigUint64(0,BigInt(s)),new Uint8Array(w)},n=s=>[t(s.identifier),r(s.size),s],i=this.map(n).flat();return new Blob(i)}arrayBuffer(){return this.blob().arrayBuffer()}stream(){return this.blob().stream()}static async parse(t){const r=new Blob([t]),n=[];let i=0;const s=(o,b)=>{const l=new E(b,[r.slice(i,i+o)]);return i+=o,l},w=o=>new TextDecoder().decode(new Uint8Array(o,0,a)),h=o=>Number(new DataView(o,a).getBigUint64(0));for(;i<r.size;){const o=await s(f,"HEAD").arrayBuffer(),b=h(o),l=w(o),y=s(b,l);n.push(y)}return new A(...n)}}const k=Object.prototype.toString,H="[object Uint8Array]";function m(e,t,r){return e?e.constructor===t?!0:k.call(e)===r:!1}function z(e){return m(e,Uint8Array,H)}function N(e){if(!z(e))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function _(e,t){if(e.length===0)return new Uint8Array(0);t??(t=e.reduce((i,s)=>i+s.length,0));const r=new Uint8Array(t);let n=0;for(const i of e)N(i),r.set(i,n),n+=i.length;return r}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var c;class C extends TransformStream{constructor(r){super({...r,transform:async(n,i)=>{var s;for(g(this,c,_([u(this,c),n]));u(this,c).length>=f;){const h=Number(new DataView(u(this,c).buffer).getBigUint64(a))+f;if(u(this,c).length<h)break;const o=u(this,c).subarray(0,h),b=o.subarray(0,f),l=new TextDecoder().decode(b.subarray(0,a)),y=new E(l,[o.subarray(f)]);await((s=r==null?void 0:r.transform)==null?void 0:s.call(r,y,i)),g(this,c,u(this,c).slice(h))}}});B(this,c,new Uint8Array)}}c=new WeakMap;exports.Chunk=E;exports.HEADER_LENGTH=f;exports.IFF=A;exports.IFFTransformStream=C;exports.RawChunk=D;exports.SIZE_LENGTH=d;exports.TYPE_LENGTH=a; | ||
"use strict";var B=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var u=(e,t,r)=>(B(e,t,"read from private field"),r?r.call(e):t.get(e)),T=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},A=(e,t,r,n)=>(B(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=4,l=BigUint64Array.BYTES_PER_ELEMENT,f=a+l,S=127;function p(e){if(typeof e!="string")throw new Error("identifier must be string.");if(e.length!==a)throw new Error(`identifier must be ${a} bytes.`);for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>S)throw new Error("identifier must be ASCII characters.")}function U(e){return new TextEncoder().encode(e)}function I(e){const t=new ArrayBuffer(l);return new DataView(t).setBigUint64(0,BigInt(e)),new Uint8Array(t)}function x(e,t){const r=new Uint8Array(f);return r.set(U(e)),r.set(I(t),a),r}class g extends Blob{constructor(t,r,n){p(t),super(r,n),this.identifier=t}}class D extends Blob{constructor(t,r){p(t);const n=new Blob(r),i=x(t,n.size);super([i,n])}}class E extends Array{constructor(...t){super(...t)}blob(){const t=s=>new TextEncoder().encode(s),r=s=>{const w=new ArrayBuffer(l);return new DataView(w).setBigUint64(0,BigInt(s)),new Uint8Array(w)},n=s=>[t(s.identifier),r(s.size),s],i=this.map(n).flat();return new Blob(i)}arrayBuffer(){return this.blob().arrayBuffer()}stream(){return this.blob().stream()}static async parse(t){const r=new Blob([t]),n=[];let i=0;const s=(o,h)=>{const b=new g(h,[r.slice(i,i+o)]);return i+=o,b},w=o=>new TextDecoder().decode(new Uint8Array(o,0,a)),y=o=>Number(new DataView(o,a).getBigUint64(0));for(;i<r.size;){const o=await s(f,"HEAD").arrayBuffer(),h=y(o),b=w(o),d=s(h,b);n.push(d)}return new E(...n)}}const k=Object.prototype.toString,H="[object Uint8Array]";function m(e,t,r){return e?e.constructor===t?!0:k.call(e)===r:!1}function z(e){return m(e,Uint8Array,H)}function N(e){if(!z(e))throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function C(e,t){if(e.length===0)return new Uint8Array(0);t??(t=e.reduce((i,s)=>i+s.length,0));const r=new Uint8Array(t);let n=0;for(const i of e)N(i),r.set(i,n),n+=i.length;return r}new globalThis.TextDecoder("utf8");new globalThis.TextEncoder;Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function _(e){if(!(e!=null&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))))throw new TypeError("Expectd ArrayBuffer | ArrayBufferView, but got:"+Object.prototype.toString.call(e))}var c;class L extends TransformStream{constructor(r){super({...r,transform:async(n,i)=>{var s;for(_(n),A(this,c,C([u(this,c),new Uint8Array(n)]));u(this,c).length>=f;){const y=Number(new DataView(u(this,c).buffer).getBigUint64(a))+f;if(u(this,c).length<y)break;const o=u(this,c).subarray(0,y),h=o.subarray(0,f),b=new TextDecoder().decode(h.subarray(0,a)),d=new g(b,[o.subarray(f)]);await((s=r==null?void 0:r.transform)==null?void 0:s.call(r,d,i)),A(this,c,u(this,c).slice(y))}}});T(this,c,new Uint8Array)}}c=new WeakMap;exports.Chunk=g;exports.HEADER_LENGTH=f;exports.IFF=E;exports.IFFTransformStream=L;exports.RawChunk=D;exports.SIZE_LENGTH=l;exports.TYPE_LENGTH=a; |
{ | ||
"name": "iff.js", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "module": "./index.mjs", |
Sorry, the diff of this file is not supported yet
8459
180