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

iff.js

Package Overview
Dependencies
Maintainers
0
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.2.0 to 1.3.0

6

IFFTransformStream.d.ts
import { Chunk } from './Chunk';
export declare class IFFTransformStream<T = any> extends TransformStream<Uint8Array, T> {
private readonly transformer?;
private buffer;
constructor(transformer?: Transformer<Chunk, T> | undefined);
transform: (_chunk: Uint8Array, controller: TransformStreamDefaultController<T>) => Promise<void>;
#private;
constructor(transformer?: Transformer<Chunk, T>);
}

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

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