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.4.0 to 2.0.0

5

Chunk.d.ts
export declare class Chunk extends Blob {
readonly identifier: string;
get header(): Uint8Array;
constructor(blobParts: BlobPart[], options: BlobPropertyBag & {
identifier: string;
});
constructor(identifier: string, blobParts?: BlobPart[], options?: BlobPropertyBag);
}

@@ -8,0 +5,0 @@ export declare class RawChunk extends Blob {

2

index.js

@@ -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,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;
"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;
{
"name": "iff.js",
"version": "1.4.0",
"version": "2.0.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