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

iff.js

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iff.js - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

2

index.d.ts
export { IFF } from './IFF';
export { Chunk } from './Chunk';
export { Chunk, RawChunk } from './Chunk';
export { IFFTransformStream } from './IFFTransformStream';
export * from './constants';

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

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

@@ -5,0 +5,0 @@ "module": "./index.mjs",

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