New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.1.0 to 1.2.0

IFFTransformStream.d.ts

1

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

@@ -4,0 +5,0 @@ identifier: string;

export { IFF } from './IFF';
export { Chunk } from './Chunk';
export { IFFTransformStream } from './IFFTransformStream';
export * from './constants';

2

index.js

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

"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=4,E=BigUint64Array.BYTES_PER_ELEMENT,l=o+E,g=127;function y(c){if(typeof c!="string")throw new Error("identifier must be string.");if(c.length!==o)throw new Error(`identifier must be ${o} bytes.`);for(let e=0;e<c.length;e++)if(c.charCodeAt(e)>g)throw new Error("identifier must be ASCII characters.")}class d extends Blob{constructor(e,i){const{identifier:s,...n}=i;super(e,n),y(s),this.identifier=s}}class b extends Array{constructor(...e){super(...e)}blob(){const e=t=>new TextEncoder().encode(t),i=t=>{const a=new ArrayBuffer(E);return new DataView(a).setBigUint64(0,BigInt(t)),new Uint8Array(a)},s=t=>[e(t.identifier),i(t.size),t],n=this.map(s).flat();return new Blob(n)}arrayBuffer(){return this.blob().arrayBuffer()}stream(){return this.blob().stream()}static async parse(e){const i=new Blob([e]),s=[];let n=0;const t=(r,u)=>{const f=new d([i.slice(n,n+r)],{identifier:u});return n+=r,f},a=r=>new TextDecoder().decode(new Uint8Array(r,0,o)),w=r=>Number(new DataView(r,o).getBigUint64(0));for(;n<i.size;){const r=await t(l,"HEAD").arrayBuffer(),u=w(r),f=a(r),h=t(u,f);s.push(h)}return new b(...s)}}exports.Chunk=d;exports.HEADER_LENGTH=l;exports.IFF=b;exports.SIZE_LENGTH=E;exports.TYPE_LENGTH=o;
"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;
{
"name": "iff.js",
"version": "1.1.0",
"version": "1.2.0",
"main": "./index.js",
"module": "./index.mjs",
"typings": "./index.d.ts"
"typings": "./index.d.ts",
"dependencies": {
"uint8array-extras": "^1.4.0"
}
}

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