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 1.3.0 to 1.4.0

3

Chunk.d.ts

@@ -8,1 +8,4 @@ export declare class Chunk extends Blob {

}
export declare class RawChunk extends Blob {
constructor(identifier: string, blobParts?: BlobPart[]);
}

2

index.js

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

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