uint8arraylist 2.4.9 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +4 -4
- package/dist/src/index.d.ts +13 -13
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +18 -18
package/dist/index.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Uint8Arraylist = factory()}(typeof self !== 'undefined' ? self : this, function () {
|
|
2
|
-
"use strict";var Uint8Arraylist=(()=>{var c=Object.defineProperty;var
|
|
2
|
+
"use strict";var Uint8Arraylist=(()=>{var c=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var B=Object.prototype.hasOwnProperty;var O=(s,t)=>{for(var n in t)c(s,n,{get:t[n],enumerable:!0})},k=(s,t,n,e)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of v(t))!B.call(s,r)&&r!==n&&c(s,r,{get:()=>t[r],enumerable:!(e=d(t,r))||e.enumerable});return s};var F=s=>k(c({},"__esModule",{value:!0}),s);var I={};O(I,{Uint8ArrayList:()=>p,isUint8ArrayList:()=>l});function a(s=0){return new Uint8Array(s)}function g(s=0){return new Uint8Array(s)}function N(s){return s?.buffer instanceof ArrayBuffer}function A(s){if(N(s))return s;let t=s.slice();return new Uint8Array(t.buffer,0,t.byteLength)}function L(s,t){t==null&&(t=s.reduce((r,i)=>r+i.length,0));let n=g(t),e=0;for(let r of s)n.set(r,e),e+=r.length;return A(n)}function m(s,t){if(s===t)return!0;if(s.byteLength!==t.byteLength)return!1;for(let n=0;n<s.byteLength;n++)if(s[n]!==t[n])return!1;return!0}var V=Symbol.for("@achingbrain/uint8arraylist");function D(s,t){if(t==null||t<0)throw new RangeError("index is out of bounds");let n=0;for(let e of s){let r=n+e.byteLength;if(t<r)return{buf:e,index:t-n};n=r}throw new RangeError("index is out of bounds")}function l(s){return!!s?.[V]}var p=class s{bufs;length;[V]=!0;constructor(...t){this.bufs=[],this.length=0,t.length>0&&this.appendAll(t)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...t){this.appendAll(t)}appendAll(t){let n=0;for(let e of t)if(e instanceof Uint8Array)n+=e.byteLength,this.bufs.push(e);else if(l(e)){n+=e.byteLength;for(let r of e.bufs)this.bufs.push(r)}else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=n}prepend(...t){this.prependAll(t)}prependAll(t){let n=0;for(let e of t.reverse())if(e instanceof Uint8Array)n+=e.byteLength,this.bufs.unshift(e);else if(l(e))n+=e.byteLength,this.bufs.unshift(...e.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=n}get(t){let n=D(this.bufs,t);return n.buf[n.index]}set(t,n){let e=D(this.bufs,t);e.buf[e.index]=n}write(t,n=0){if(t instanceof Uint8Array)for(let e=0;e<t.length;e++)this.set(n+e,t[e]);else if(l(t))for(let e=0;e<t.length;e++)this.set(n+e,t.get(e));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(t){if(t=Math.trunc(t),!(Number.isNaN(t)||t<=0)){if(t===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(t>=this.bufs[0].byteLength)t-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(t),this.length-=t;break}}}slice(t,n){let{bufs:e,length:r}=this._subList(t,n);return L(e,r)}subarray(t,n){let{bufs:e,length:r}=this._subList(t,n);return e.length===1?e[0]:L(e,r)}sublist(t,n){let{bufs:e,length:r}=this._subList(t,n),i=new s;return i.length=r,i.bufs=e,i}_subList(t,n){if(t=t??0,n=n??this.length,t<0&&(t=this.length+t),n<0&&(n=this.length+n),t<0||n>this.length)throw new RangeError("index is out of bounds");if(t===n)return{bufs:[],length:0};if(t===0&&n===this.length)return{bufs:[...this.bufs],length:this.length};let e=[],r=0;for(let i=0;i<this.bufs.length;i++){let o=this.bufs[i],u=r,h=u+o.byteLength;if(r=h,t>=h)continue;let y=t>=u&&t<h,b=n>u&&n<=h;if(y&&b){if(t===u&&n===h){e.push(o);break}let f=t-u;e.push(o.subarray(f,f+(n-t)));break}if(y){if(t===0){e.push(o);continue}e.push(o.subarray(t-u));continue}if(b){if(n===h){e.push(o);break}e.push(o.subarray(0,n-u));break}e.push(o)}return{bufs:e,length:n-t}}indexOf(t,n=0){if(!l(t)&&!(t instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let e=t instanceof Uint8Array?t:t.subarray();if(n=Number(n??0),isNaN(n)&&(n=0),n<0&&(n=this.length+n),n<0&&(n=0),t.length===0)return n>this.length?this.length:n;let r=e.byteLength;if(r===0)throw new TypeError("search must be at least 1 byte long");let i=256,o=new Int32Array(i);for(let f=0;f<i;f++)o[f]=-1;for(let f=0;f<r;f++)o[e[f]]=f;let u=o,h=this.byteLength-e.byteLength,y=e.byteLength-1,b;for(let f=n;f<=h;f+=b){b=0;for(let w=y;w>=0;w--){let U=this.get(f+w);if(e[w]!==U){b=Math.max(1,w-u[U]);break}}if(b===0)return f}return-1}getInt8(t){let n=this.subarray(t,t+1);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt8(0)}setInt8(t,n){let e=g(1);new DataView(e.buffer,e.byteOffset,e.byteLength).setInt8(0,n),this.write(e,t)}getInt16(t,n){let e=this.subarray(t,t+2);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt16(0,n)}setInt16(t,n,e){let r=a(2);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt16(0,n,e),this.write(r,t)}getInt32(t,n){let e=this.subarray(t,t+4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getInt32(0,n)}setInt32(t,n,e){let r=a(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setInt32(0,n,e),this.write(r,t)}getBigInt64(t,n){let e=this.subarray(t,t+8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getBigInt64(0,n)}setBigInt64(t,n,e){let r=a(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setBigInt64(0,n,e),this.write(r,t)}getUint8(t){let n=this.subarray(t,t+1);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint8(0)}setUint8(t,n){let e=g(1);new DataView(e.buffer,e.byteOffset,e.byteLength).setUint8(0,n),this.write(e,t)}getUint16(t,n){let e=this.subarray(t,t+2);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint16(0,n)}setUint16(t,n,e){let r=a(2);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint16(0,n,e),this.write(r,t)}getUint32(t,n){let e=this.subarray(t,t+4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,n)}setUint32(t,n,e){let r=a(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setUint32(0,n,e),this.write(r,t)}getBigUint64(t,n){let e=this.subarray(t,t+8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getBigUint64(0,n)}setBigUint64(t,n,e){let r=a(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setBigUint64(0,n,e),this.write(r,t)}getFloat32(t,n){let e=this.subarray(t,t+4);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat32(0,n)}setFloat32(t,n,e){let r=a(4);new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat32(0,n,e),this.write(r,t)}getFloat64(t,n){let e=this.subarray(t,t+8);return new DataView(e.buffer,e.byteOffset,e.byteLength).getFloat64(0,n)}setFloat64(t,n,e){let r=a(8);new DataView(r.buffer,r.byteOffset,r.byteLength).setFloat64(0,n,e),this.write(r,t)}equals(t){if(t==null||!(t instanceof s)||t.bufs.length!==this.bufs.length)return!1;for(let n=0;n<this.bufs.length;n++)if(!m(this.bufs[n],t.bufs[n]))return!1;return!0}static fromUint8Arrays(t,n){let e=new s;return e.bufs=t,n==null&&(n=t.reduce((r,i)=>r+i.byteLength,0)),e.length=n,e}};return F(I);})();
|
|
3
3
|
return Uint8Arraylist}));
|
|
4
4
|
//# sourceMappingURL=index.min.js.map
|
package/dist/index.min.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/index.ts", "../node_modules/uint8arrays/src/alloc.ts", "../node_modules/uint8arrays/src/concat.ts", "../node_modules/uint8arrays/src/equals.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * @packageDocumentation\n *\n * A class that lets you do operations over a list of Uint8Arrays without\n * copying them.\n *\n * ```js\n * import { Uint8ArrayList } from 'uint8arraylist'\n *\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray()\n * // -> Uint8Array([0, 1, 2, 3, 4, 5])\n *\n * list.consume(3)\n * list.subarray()\n * // -> Uint8Array([3, 4, 5])\n *\n * // you can also iterate over the list\n * for (const buf of list) {\n * // ..do something with `buf`\n * }\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ## Converting Uint8ArrayLists to Uint8Arrays\n *\n * There are two ways to turn a `Uint8ArrayList` into a `Uint8Array` - `.slice` and `.subarray` and one way to turn a `Uint8ArrayList` into a `Uint8ArrayList` with different contents - `.sublist`.\n *\n * ### slice\n *\n * Slice follows the same semantics as [Uint8Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice) in that it creates a new `Uint8Array` and copies bytes into it using an optional offset & length.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.slice(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ### subarray\n *\n * Subarray attempts to follow the same semantics as [Uint8Array.subarray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray) with one important different - this is a no-copy operation, unless the requested bytes span two internal buffers in which case it is a copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0]) - no-copy\n *\n * list.subarray(2, 5)\n * // -> Uint8Array([2, 3, 4]) - copy\n * ```\n *\n * ### sublist\n *\n * Sublist creates and returns a new `Uint8ArrayList` that shares the underlying buffers with the original so is always a no-copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.sublist(0, 1)\n * // -> Uint8ArrayList([0]) - no-copy\n *\n * list.sublist(2, 5)\n * // -> Uint8ArrayList([2], [3, 4]) - no-copy\n * ```\n *\n * ## Inspiration\n *\n * Borrows liberally from [bl](https://www.npmjs.com/package/bl) but only uses native JS types.\n */\nimport { allocUnsafe, alloc } from 'uint8arrays/alloc'\nimport { concat } from 'uint8arrays/concat'\nimport { equals } from 'uint8arrays/equals'\n\nconst symbol = Symbol.for('@achingbrain/uint8arraylist')\n\nexport type Appendable = Uint8ArrayList | Uint8Array\n\nfunction findBufAndOffset (bufs: Uint8Array[], index: number): { buf: Uint8Array, index: number } {\n if (index == null || index < 0) {\n throw new RangeError('index is out of bounds')\n }\n\n let offset = 0\n\n for (const buf of bufs) {\n const bufEnd = offset + buf.byteLength\n\n if (index < bufEnd) {\n return {\n buf,\n index: index - offset\n }\n }\n\n offset = bufEnd\n }\n\n throw new RangeError('index is out of bounds')\n}\n\n/**\n * Check if object is a CID instance\n *\n * @example\n *\n * ```js\n * import { isUint8ArrayList, Uint8ArrayList } from 'uint8arraylist'\n *\n * isUint8ArrayList(true) // false\n * isUint8ArrayList([]) // false\n * isUint8ArrayList(new Uint8ArrayList()) // true\n * ```\n */\nexport function isUint8ArrayList (value: any): value is Uint8ArrayList {\n return Boolean(value?.[symbol])\n}\n\nexport class Uint8ArrayList implements Iterable<Uint8Array> {\n private bufs: Uint8Array[]\n public length: number\n public readonly [symbol] = true\n\n constructor (...data: Appendable[]) {\n this.bufs = []\n this.length = 0\n\n if (data.length > 0) {\n this.appendAll(data)\n }\n }\n\n * [Symbol.iterator] (): Iterator<Uint8Array> {\n yield * this.bufs\n }\n\n get byteLength (): number {\n return this.length\n }\n\n /**\n * Add one or more `bufs` to the end of this Uint8ArrayList\n */\n append (...bufs: Appendable[]): void {\n this.appendAll(bufs)\n }\n\n /**\n * Add all `bufs` to the end of this Uint8ArrayList\n */\n appendAll (bufs: Appendable[]): void {\n let length = 0\n\n for (const buf of bufs) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength\n this.bufs.push(buf)\n } else if (isUint8ArrayList(buf)) {\n length += buf.byteLength\n for (const chunk of buf.bufs) {\n this.bufs.push(chunk)\n }\n } else {\n throw new Error('Could not append value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n this.length += length\n }\n\n /**\n * Add one or more `bufs` to the start of this Uint8ArrayList\n */\n prepend (...bufs: Appendable[]): void {\n this.prependAll(bufs)\n }\n\n /**\n * Add all `bufs` to the start of this Uint8ArrayList\n */\n prependAll (bufs: Appendable[]): void {\n let length = 0\n\n for (const buf of bufs.reverse()) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength\n this.bufs.unshift(buf)\n } else if (isUint8ArrayList(buf)) {\n length += buf.byteLength\n this.bufs.unshift(...buf.bufs)\n } else {\n throw new Error('Could not prepend value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n this.length += length\n }\n\n /**\n * Read the value at `index`\n */\n get (index: number): number {\n const res = findBufAndOffset(this.bufs, index)\n\n return res.buf[res.index]\n }\n\n /**\n * Set the value at `index` to `value`\n */\n set (index: number, value: number): void {\n const res = findBufAndOffset(this.bufs, index)\n\n res.buf[res.index] = value\n }\n\n /**\n * Copy bytes from `buf` to the index specified by `offset`\n */\n write (buf: Appendable, offset: number = 0): void {\n if (buf instanceof Uint8Array) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf[i])\n }\n } else if (isUint8ArrayList(buf)) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf.get(i))\n }\n } else {\n throw new Error('Could not write value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n /**\n * Remove bytes from the front of the pool\n */\n consume (bytes: number): void {\n // first, normalize the argument, in accordance with how Buffer does it\n bytes = Math.trunc(bytes)\n\n // do nothing if not a positive number\n if (Number.isNaN(bytes) || bytes <= 0) {\n return\n }\n\n // if consuming all bytes, skip iterating\n if (bytes === this.byteLength) {\n this.bufs = []\n this.length = 0\n return\n }\n\n while (this.bufs.length > 0) {\n if (bytes >= this.bufs[0].byteLength) {\n bytes -= this.bufs[0].byteLength\n this.length -= this.bufs[0].byteLength\n this.bufs.shift()\n } else {\n this.bufs[0] = this.bufs[0].subarray(bytes)\n this.length -= bytes\n break\n }\n }\n }\n\n /**\n * Extracts a section of an array and returns a new array.\n *\n * This is a copy operation as it is with Uint8Arrays and Arrays\n * - note this is different to the behaviour of Node Buffers.\n */\n slice (beginInclusive?: number, endExclusive?: number): Uint8Array {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n return concat(bufs, length)\n }\n\n /**\n * Returns a alloc from the given start and end element index.\n *\n * In the best case where the data extracted comes from a single Uint8Array\n * internally this is a no-copy operation otherwise it is a copy operation.\n */\n subarray (beginInclusive?: number, endExclusive?: number): Uint8Array {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n if (bufs.length === 1) {\n return bufs[0]\n }\n\n return concat(bufs, length)\n }\n\n /**\n * Returns a new Uint8ArrayList from the given start and end element index.\n *\n * This is a no-copy operation.\n */\n sublist (beginInclusive?: number, endExclusive?: number): Uint8ArrayList {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n const list = new Uint8ArrayList()\n list.length = length\n // don't loop, just set the bufs\n list.bufs = bufs\n\n return list\n }\n\n private _subList (beginInclusive?: number, endExclusive?: number): { bufs: Uint8Array[], length: number } {\n beginInclusive = beginInclusive ?? 0\n endExclusive = endExclusive ?? this.length\n\n if (beginInclusive < 0) {\n beginInclusive = this.length + beginInclusive\n }\n\n if (endExclusive < 0) {\n endExclusive = this.length + endExclusive\n }\n\n if (beginInclusive < 0 || endExclusive > this.length) {\n throw new RangeError('index is out of bounds')\n }\n\n if (beginInclusive === endExclusive) {\n return { bufs: [], length: 0 }\n }\n\n if (beginInclusive === 0 && endExclusive === this.length) {\n return { bufs: [...this.bufs], length: this.length }\n }\n\n const bufs: Uint8Array[] = []\n let offset = 0\n\n for (let i = 0; i < this.bufs.length; i++) {\n const buf = this.bufs[i]\n const bufStart = offset\n const bufEnd = bufStart + buf.byteLength\n\n // for next loop\n offset = bufEnd\n\n if (beginInclusive >= bufEnd) {\n // start after this buf\n continue\n }\n\n const sliceStartInBuf = beginInclusive >= bufStart && beginInclusive < bufEnd\n const sliceEndsInBuf = endExclusive > bufStart && endExclusive <= bufEnd\n\n if (sliceStartInBuf && sliceEndsInBuf) {\n // slice is wholly contained within this buffer\n if (beginInclusive === bufStart && endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf)\n break\n }\n\n // requested part of buffer\n const start = beginInclusive - bufStart\n bufs.push(buf.subarray(start, start + (endExclusive - beginInclusive)))\n break\n }\n\n if (sliceStartInBuf) {\n // slice starts in this buffer\n if (beginInclusive === 0) {\n // requested whole buffer\n bufs.push(buf)\n continue\n }\n\n // requested part of buffer\n bufs.push(buf.subarray(beginInclusive - bufStart))\n continue\n }\n\n if (sliceEndsInBuf) {\n if (endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf)\n break\n }\n\n // requested part of buffer\n bufs.push(buf.subarray(0, endExclusive - bufStart))\n break\n }\n\n // slice started before this buffer and ends after it\n bufs.push(buf)\n }\n\n return { bufs, length: endExclusive - beginInclusive }\n }\n\n indexOf (search: Uint8ArrayList | Uint8Array, offset: number = 0): number {\n if (!isUint8ArrayList(search) && !(search instanceof Uint8Array)) {\n throw new TypeError('The \"value\" argument must be a Uint8ArrayList or Uint8Array')\n }\n\n const needle = search instanceof Uint8Array ? search : search.subarray()\n\n offset = Number(offset ?? 0)\n\n if (isNaN(offset)) {\n offset = 0\n }\n\n if (offset < 0) {\n offset = this.length + offset\n }\n\n if (offset < 0) {\n offset = 0\n }\n\n if (search.length === 0) {\n return offset > this.length ? this.length : offset\n }\n\n // https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm\n const M: number = needle.byteLength\n\n if (M === 0) {\n throw new TypeError('search must be at least 1 byte long')\n }\n\n // radix\n const radix: number = 256\n const rightmostPositions: Int32Array = new Int32Array(radix)\n\n // position of the rightmost occurrence of the byte c in the pattern\n for (let c: number = 0; c < radix; c++) {\n // -1 for bytes not in pattern\n rightmostPositions[c] = -1\n }\n\n for (let j = 0; j < M; j++) {\n // rightmost position for bytes in pattern\n rightmostPositions[needle[j]] = j\n }\n\n // Return offset of first match, -1 if no match\n const right = rightmostPositions\n const lastIndex = this.byteLength - needle.byteLength\n const lastPatIndex = needle.byteLength - 1\n let skip: number\n\n for (let i = offset; i <= lastIndex; i += skip) {\n skip = 0\n\n for (let j = lastPatIndex; j >= 0; j--) {\n const char: number = this.get(i + j)\n\n if (needle[j] !== char) {\n skip = Math.max(1, j - right[char])\n break\n }\n }\n\n if (skip === 0) {\n return i\n }\n }\n\n return -1\n }\n\n getInt8 (byteOffset: number): number {\n const buf = this.subarray(byteOffset, byteOffset + 1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt8(0)\n }\n\n setInt8 (byteOffset: number, value: number): void {\n const buf = allocUnsafe(1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt8(0, value)\n\n this.write(buf, byteOffset)\n }\n\n getInt16 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt16(0, littleEndian)\n }\n\n setInt16 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt16(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getInt32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt32(0, littleEndian)\n }\n\n setInt32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getBigInt64 (byteOffset: number, littleEndian?: boolean): bigint {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getBigInt64(0, littleEndian)\n }\n\n setBigInt64 (byteOffset: number, value: bigint, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setBigInt64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getUint8 (byteOffset: number): number {\n const buf = this.subarray(byteOffset, byteOffset + 1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint8(0)\n }\n\n setUint8 (byteOffset: number, value: number): void {\n const buf = allocUnsafe(1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint8(0, value)\n\n this.write(buf, byteOffset)\n }\n\n getUint16 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint16(0, littleEndian)\n }\n\n setUint16 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint16(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getUint32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint32(0, littleEndian)\n }\n\n setUint32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getBigUint64 (byteOffset: number, littleEndian?: boolean): bigint {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getBigUint64(0, littleEndian)\n }\n\n setBigUint64 (byteOffset: number, value: bigint, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setBigUint64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getFloat32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getFloat32(0, littleEndian)\n }\n\n setFloat32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setFloat32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getFloat64 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getFloat64(0, littleEndian)\n }\n\n setFloat64 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setFloat64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n equals (other: any): other is Uint8ArrayList {\n if (other == null) {\n return false\n }\n\n if (!(other instanceof Uint8ArrayList)) {\n return false\n }\n\n if (other.bufs.length !== this.bufs.length) {\n return false\n }\n\n for (let i = 0; i < this.bufs.length; i++) {\n if (!equals(this.bufs[i], other.bufs[i])) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this\n * method if you know the total size of all the Uint8Arrays ahead of time.\n */\n static fromUint8Arrays (bufs: Uint8Array[], length?: number): Uint8ArrayList {\n const list = new Uint8ArrayList()\n list.bufs = bufs\n\n if (length == null) {\n length = bufs.reduce((acc, curr) => acc + curr.byteLength, 0)\n }\n\n list.length = length\n\n return list\n }\n}\n\n/*\nfunction indexOf (needle: Uint8Array, haystack: Uint8Array, offset = 0) {\n for (let i = offset; i < haystack.byteLength; i++) {\n for (let j = 0; j < needle.length; j++) {\n if (haystack[i + j] !== needle[j]) {\n break\n }\n\n if (j === needle.byteLength -1) {\n return i\n }\n }\n\n if (haystack.byteLength - i < needle.byteLength) {\n break\n }\n }\n\n return -1\n}\n*/\n", "/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nexport function alloc (size: number = 0): Uint8Array {\n return new Uint8Array(size)\n}\n\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nexport function allocUnsafe (size: number = 0): Uint8Array {\n return new Uint8Array(size)\n}\n", "import { allocUnsafe } from '#alloc'\nimport { asUint8Array } from '#util/as-uint8array'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nexport function concat (arrays: Uint8Array[], length?: number): Uint8Array {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = allocUnsafe(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return asUint8Array(output)\n}\n", "/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nexport function equals (a: Uint8Array, b: Uint8Array): boolean {\n if (a === b) {\n return true\n }\n\n if (a.byteLength !== b.byteLength) {\n return false\n }\n\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n}\n"],
|
|
5
|
-
"mappings": ";kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,qBAAAC,ICIM,SAAUC,EAAOC,EAAe,EAAC,CACrC,OAAO,IAAI,WAAWA,CAAI,CAC5B,CAOM,SAAUC,EAAaD,EAAe,EAAC,CAC3C,OAAO,IAAI,WAAWA,CAAI,CAC5B,
|
|
6
|
-
"names": ["index_exports", "__export", "Uint8ArrayList", "isUint8ArrayList", "alloc", "size", "allocUnsafe", "concat", "arrays", "length", "acc", "curr", "output", "allocUnsafe", "offset", "arr", "equals", "a", "b", "i", "symbol", "findBufAndOffset", "bufs", "index", "offset", "buf", "bufEnd", "isUint8ArrayList", "value", "Uint8ArrayList", "_Uint8ArrayList", "data", "length", "chunk", "res", "i", "bytes", "beginInclusive", "endExclusive", "concat", "list", "bufStart", "sliceStartInBuf", "sliceEndsInBuf", "start", "search", "needle", "M", "radix", "rightmostPositions", "c", "j", "right", "lastIndex", "lastPatIndex", "skip", "char", "byteOffset", "allocUnsafe", "littleEndian", "alloc", "other", "equals", "acc", "curr"]
|
|
3
|
+
"sources": ["../src/index.ts", "../node_modules/uint8arrays/src/alloc.ts", "../node_modules/uint8arrays/src/util/as-uint8array.ts", "../node_modules/uint8arrays/src/concat.ts", "../node_modules/uint8arrays/src/equals.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * @packageDocumentation\n *\n * A class that lets you do operations over a list of Uint8Arrays without\n * copying them.\n *\n * ```js\n * import { Uint8ArrayList } from 'uint8arraylist'\n *\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray()\n * // -> Uint8Array([0, 1, 2, 3, 4, 5])\n *\n * list.consume(3)\n * list.subarray()\n * // -> Uint8Array([3, 4, 5])\n *\n * // you can also iterate over the list\n * for (const buf of list) {\n * // ..do something with `buf`\n * }\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ## Converting Uint8ArrayLists to Uint8Arrays\n *\n * There are two ways to turn a `Uint8ArrayList` into a `Uint8Array` - `.slice` and `.subarray` and one way to turn a `Uint8ArrayList` into a `Uint8ArrayList` with different contents - `.sublist`.\n *\n * ### slice\n *\n * Slice follows the same semantics as [Uint8Array.slice](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/slice) in that it creates a new `Uint8Array` and copies bytes into it using an optional offset & length.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.slice(0, 1)\n * // -> Uint8Array([0])\n * ```\n *\n * ### subarray\n *\n * Subarray attempts to follow the same semantics as [Uint8Array.subarray](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray) with one important different - this is a no-copy operation, unless the requested bytes span two internal buffers in which case it is a copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.subarray(0, 1)\n * // -> Uint8Array([0]) - no-copy\n *\n * list.subarray(2, 5)\n * // -> Uint8Array([2, 3, 4]) - copy\n * ```\n *\n * ### sublist\n *\n * Sublist creates and returns a new `Uint8ArrayList` that shares the underlying buffers with the original so is always a no-copy operation.\n *\n * ```js\n * const list = new Uint8ArrayList()\n * list.append(Uint8Array.from([0, 1, 2]))\n * list.append(Uint8Array.from([3, 4, 5]))\n *\n * list.sublist(0, 1)\n * // -> Uint8ArrayList([0]) - no-copy\n *\n * list.sublist(2, 5)\n * // -> Uint8ArrayList([2], [3, 4]) - no-copy\n * ```\n *\n * ## Inspiration\n *\n * Borrows liberally from [bl](https://www.npmjs.com/package/bl) but only uses native JS types.\n */\nimport { allocUnsafe, alloc } from 'uint8arrays/alloc'\nimport { concat } from 'uint8arrays/concat'\nimport { equals } from 'uint8arrays/equals'\n\nconst symbol = Symbol.for('@achingbrain/uint8arraylist')\n\nexport type Appendable<T extends ArrayBufferLike = ArrayBuffer> = Uint8ArrayList<T> | Uint8Array<T>\n\nfunction findBufAndOffset (bufs: Uint8Array[], index: number): { buf: Uint8Array, index: number } {\n if (index == null || index < 0) {\n throw new RangeError('index is out of bounds')\n }\n\n let offset = 0\n\n for (const buf of bufs) {\n const bufEnd = offset + buf.byteLength\n\n if (index < bufEnd) {\n return {\n buf,\n index: index - offset\n }\n }\n\n offset = bufEnd\n }\n\n throw new RangeError('index is out of bounds')\n}\n\n/**\n * Check if object is a CID instance\n *\n * @example\n *\n * ```js\n * import { isUint8ArrayList, Uint8ArrayList } from 'uint8arraylist'\n *\n * isUint8ArrayList(true) // false\n * isUint8ArrayList([]) // false\n * isUint8ArrayList(new Uint8ArrayList()) // true\n * ```\n */\nexport function isUint8ArrayList (value: any): value is Uint8ArrayList {\n return Boolean(value?.[symbol])\n}\n\nexport class Uint8ArrayList <T extends ArrayBufferLike = ArrayBufferLike> implements Iterable<Uint8Array<T>> {\n private bufs: Uint8Array<T>[]\n public length: number\n public readonly [symbol] = true\n\n constructor (...data: Appendable<T>[]) {\n this.bufs = []\n this.length = 0\n\n if (data.length > 0) {\n this.appendAll(data)\n }\n }\n\n * [Symbol.iterator] (): Iterator<Uint8Array<T>> {\n yield * this.bufs\n }\n\n get byteLength (): number {\n return this.length\n }\n\n /**\n * Add one or more `bufs` to the end of this Uint8ArrayList\n */\n append (...bufs: Appendable<T>[]): void {\n this.appendAll(bufs)\n }\n\n /**\n * Add all `bufs` to the end of this Uint8ArrayList\n */\n appendAll (bufs: Appendable<T>[]): void {\n let length = 0\n\n for (const buf of bufs) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength\n this.bufs.push(buf)\n } else if (isUint8ArrayList(buf)) {\n length += buf.byteLength\n for (const chunk of buf.bufs) {\n this.bufs.push(chunk)\n }\n } else {\n throw new Error('Could not append value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n this.length += length\n }\n\n /**\n * Add one or more `bufs` to the start of this Uint8ArrayList\n */\n prepend (...bufs: Appendable<T>[]): void {\n this.prependAll(bufs)\n }\n\n /**\n * Add all `bufs` to the start of this Uint8ArrayList\n */\n prependAll (bufs: Appendable<T>[]): void {\n let length = 0\n\n for (const buf of bufs.reverse()) {\n if (buf instanceof Uint8Array) {\n length += buf.byteLength\n this.bufs.unshift(buf)\n } else if (isUint8ArrayList(buf)) {\n length += buf.byteLength\n this.bufs.unshift(...buf.bufs)\n } else {\n throw new Error('Could not prepend value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n this.length += length\n }\n\n /**\n * Read the value at `index`\n */\n get (index: number): number {\n const res = findBufAndOffset(this.bufs, index)\n\n return res.buf[res.index]\n }\n\n /**\n * Set the value at `index` to `value`\n */\n set (index: number, value: number): void {\n const res = findBufAndOffset(this.bufs, index)\n\n res.buf[res.index] = value\n }\n\n /**\n * Copy bytes from `buf` to the index specified by `offset`\n */\n write (buf: Appendable<T | ArrayBuffer>, offset: number = 0): void {\n if (buf instanceof Uint8Array) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf[i])\n }\n } else if (isUint8ArrayList(buf)) {\n for (let i = 0; i < buf.length; i++) {\n this.set(offset + i, buf.get(i))\n }\n } else {\n throw new Error('Could not write value, must be an Uint8Array or a Uint8ArrayList')\n }\n }\n\n /**\n * Remove bytes from the front of the pool\n */\n consume (bytes: number): void {\n // first, normalize the argument, in accordance with how Buffer does it\n bytes = Math.trunc(bytes)\n\n // do nothing if not a positive number\n if (Number.isNaN(bytes) || bytes <= 0) {\n return\n }\n\n // if consuming all bytes, skip iterating\n if (bytes === this.byteLength) {\n this.bufs = []\n this.length = 0\n return\n }\n\n while (this.bufs.length > 0) {\n if (bytes >= this.bufs[0].byteLength) {\n bytes -= this.bufs[0].byteLength\n this.length -= this.bufs[0].byteLength\n this.bufs.shift()\n } else {\n this.bufs[0] = this.bufs[0].subarray(bytes)\n this.length -= bytes\n break\n }\n }\n }\n\n /**\n * Extracts a section of an array and returns a new array.\n *\n * This is a copy operation as it is with Uint8Arrays and Arrays\n * - note this is different to the behaviour of Node Buffers.\n */\n slice (beginInclusive?: number, endExclusive?: number): Uint8Array<ArrayBuffer> {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n return concat(bufs, length)\n }\n\n /**\n * Returns a alloc from the given start and end element index.\n *\n * In the best case where the data extracted comes from a single Uint8Array\n * internally this is a no-copy operation otherwise it is a copy operation.\n */\n subarray (beginInclusive?: number, endExclusive?: number): Uint8Array<T | ArrayBuffer> {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n if (bufs.length === 1) {\n return bufs[0]\n }\n\n return concat(bufs, length)\n }\n\n /**\n * Returns a new Uint8ArrayList from the given start and end element index.\n *\n * This is a no-copy operation.\n */\n sublist (beginInclusive?: number, endExclusive?: number): Uint8ArrayList<T> {\n const { bufs, length } = this._subList(beginInclusive, endExclusive)\n\n const list = new Uint8ArrayList<T>()\n list.length = length\n // don't loop, just set the bufs\n list.bufs = bufs\n\n return list\n }\n\n private _subList (beginInclusive?: number, endExclusive?: number): { bufs: Uint8Array<T>[], length: number } {\n beginInclusive = beginInclusive ?? 0\n endExclusive = endExclusive ?? this.length\n\n if (beginInclusive < 0) {\n beginInclusive = this.length + beginInclusive\n }\n\n if (endExclusive < 0) {\n endExclusive = this.length + endExclusive\n }\n\n if (beginInclusive < 0 || endExclusive > this.length) {\n throw new RangeError('index is out of bounds')\n }\n\n if (beginInclusive === endExclusive) {\n return { bufs: [], length: 0 }\n }\n\n if (beginInclusive === 0 && endExclusive === this.length) {\n return { bufs: [...this.bufs], length: this.length }\n }\n\n const bufs: Uint8Array<T>[] = []\n let offset = 0\n\n for (let i = 0; i < this.bufs.length; i++) {\n const buf = this.bufs[i]\n const bufStart = offset\n const bufEnd = bufStart + buf.byteLength\n\n // for next loop\n offset = bufEnd\n\n if (beginInclusive >= bufEnd) {\n // start after this buf\n continue\n }\n\n const sliceStartInBuf = beginInclusive >= bufStart && beginInclusive < bufEnd\n const sliceEndsInBuf = endExclusive > bufStart && endExclusive <= bufEnd\n\n if (sliceStartInBuf && sliceEndsInBuf) {\n // slice is wholly contained within this buffer\n if (beginInclusive === bufStart && endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf)\n break\n }\n\n // requested part of buffer\n const start = beginInclusive - bufStart\n bufs.push(buf.subarray(start, start + (endExclusive - beginInclusive)))\n break\n }\n\n if (sliceStartInBuf) {\n // slice starts in this buffer\n if (beginInclusive === 0) {\n // requested whole buffer\n bufs.push(buf)\n continue\n }\n\n // requested part of buffer\n bufs.push(buf.subarray(beginInclusive - bufStart))\n continue\n }\n\n if (sliceEndsInBuf) {\n if (endExclusive === bufEnd) {\n // requested whole buffer\n bufs.push(buf)\n break\n }\n\n // requested part of buffer\n bufs.push(buf.subarray(0, endExclusive - bufStart))\n break\n }\n\n // slice started before this buffer and ends after it\n bufs.push(buf)\n }\n\n return { bufs, length: endExclusive - beginInclusive }\n }\n\n indexOf (search: Uint8ArrayList | Uint8Array, offset: number = 0): number {\n if (!isUint8ArrayList(search) && !(search instanceof Uint8Array)) {\n throw new TypeError('The \"value\" argument must be a Uint8ArrayList or Uint8Array')\n }\n\n const needle = search instanceof Uint8Array ? search : search.subarray()\n\n offset = Number(offset ?? 0)\n\n if (isNaN(offset)) {\n offset = 0\n }\n\n if (offset < 0) {\n offset = this.length + offset\n }\n\n if (offset < 0) {\n offset = 0\n }\n\n if (search.length === 0) {\n return offset > this.length ? this.length : offset\n }\n\n // https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm\n const M: number = needle.byteLength\n\n if (M === 0) {\n throw new TypeError('search must be at least 1 byte long')\n }\n\n // radix\n const radix: number = 256\n const rightmostPositions: Int32Array = new Int32Array(radix)\n\n // position of the rightmost occurrence of the byte c in the pattern\n for (let c: number = 0; c < radix; c++) {\n // -1 for bytes not in pattern\n rightmostPositions[c] = -1\n }\n\n for (let j = 0; j < M; j++) {\n // rightmost position for bytes in pattern\n rightmostPositions[needle[j]] = j\n }\n\n // Return offset of first match, -1 if no match\n const right = rightmostPositions\n const lastIndex = this.byteLength - needle.byteLength\n const lastPatIndex = needle.byteLength - 1\n let skip: number\n\n for (let i = offset; i <= lastIndex; i += skip) {\n skip = 0\n\n for (let j = lastPatIndex; j >= 0; j--) {\n const char: number = this.get(i + j)\n\n if (needle[j] !== char) {\n skip = Math.max(1, j - right[char])\n break\n }\n }\n\n if (skip === 0) {\n return i\n }\n }\n\n return -1\n }\n\n getInt8 (byteOffset: number): number {\n const buf = this.subarray(byteOffset, byteOffset + 1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt8(0)\n }\n\n setInt8 (byteOffset: number, value: number): void {\n const buf = allocUnsafe(1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt8(0, value)\n\n this.write(buf, byteOffset)\n }\n\n getInt16 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt16(0, littleEndian)\n }\n\n setInt16 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt16(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getInt32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getInt32(0, littleEndian)\n }\n\n setInt32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setInt32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getBigInt64 (byteOffset: number, littleEndian?: boolean): bigint {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getBigInt64(0, littleEndian)\n }\n\n setBigInt64 (byteOffset: number, value: bigint, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setBigInt64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getUint8 (byteOffset: number): number {\n const buf = this.subarray(byteOffset, byteOffset + 1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint8(0)\n }\n\n setUint8 (byteOffset: number, value: number): void {\n const buf = allocUnsafe(1)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint8(0, value)\n\n this.write(buf, byteOffset)\n }\n\n getUint16 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint16(0, littleEndian)\n }\n\n setUint16 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(2)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint16(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getUint32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getUint32(0, littleEndian)\n }\n\n setUint32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setUint32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getBigUint64 (byteOffset: number, littleEndian?: boolean): bigint {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getBigUint64(0, littleEndian)\n }\n\n setBigUint64 (byteOffset: number, value: bigint, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setBigUint64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getFloat32 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getFloat32(0, littleEndian)\n }\n\n setFloat32 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(4)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setFloat32(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n getFloat64 (byteOffset: number, littleEndian?: boolean): number {\n const buf = this.subarray(byteOffset, byteOffset + 8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n\n return view.getFloat64(0, littleEndian)\n }\n\n setFloat64 (byteOffset: number, value: number, littleEndian?: boolean): void {\n const buf = alloc(8)\n const view = new DataView(buf.buffer, buf.byteOffset, buf.byteLength)\n view.setFloat64(0, value, littleEndian)\n\n this.write(buf, byteOffset)\n }\n\n equals (other: any): other is Uint8ArrayList {\n if (other == null) {\n return false\n }\n\n if (!(other instanceof Uint8ArrayList)) {\n return false\n }\n\n if (other.bufs.length !== this.bufs.length) {\n return false\n }\n\n for (let i = 0; i < this.bufs.length; i++) {\n if (!equals(this.bufs[i], other.bufs[i])) {\n return false\n }\n }\n\n return true\n }\n\n /**\n * Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this\n * method if you know the total size of all the Uint8Arrays ahead of time.\n */\n static fromUint8Arrays <T extends ArrayBufferLike> (bufs: Uint8Array<T>[], length?: number): Uint8ArrayList<T> {\n const list = new Uint8ArrayList<T>()\n list.bufs = bufs\n\n if (length == null) {\n length = bufs.reduce((acc, curr) => acc + curr.byteLength, 0)\n }\n\n list.length = length\n\n return list\n }\n}\n\n/*\nfunction indexOf (needle: Uint8Array, haystack: Uint8Array, offset = 0) {\n for (let i = offset; i < haystack.byteLength; i++) {\n for (let j = 0; j < needle.length; j++) {\n if (haystack[i + j] !== needle[j]) {\n break\n }\n\n if (j === needle.byteLength -1) {\n return i\n }\n }\n\n if (haystack.byteLength - i < needle.byteLength) {\n break\n }\n }\n\n return -1\n}\n*/\n", "/**\n * Returns a `Uint8Array` of the requested size. Referenced memory will\n * be initialized to 0.\n */\nexport function alloc (size: number = 0): Uint8Array<ArrayBuffer> {\n return new Uint8Array(size)\n}\n\n/**\n * Where possible returns a Uint8Array of the requested size that references\n * uninitialized memory. Only use if you are certain you will immediately\n * overwrite every value in the returned `Uint8Array`.\n */\nexport function allocUnsafe (size: number = 0): Uint8Array<ArrayBuffer> {\n return new Uint8Array(size)\n}\n", "function isByteArrayWithArrayBuffer (b?: Uint8Array): b is Uint8Array<ArrayBuffer> {\n return b?.buffer instanceof ArrayBuffer\n}\n\n/**\n * To guarantee Uint8Array semantics, convert nodejs Buffers\n * into vanilla Uint8Arrays\n */\nexport function asUint8Array (buf: Uint8Array): Uint8Array<ArrayBuffer> {\n if (isByteArrayWithArrayBuffer(buf)) {\n return buf\n }\n\n const b = buf.slice()\n\n return new Uint8Array(b.buffer, 0, b.byteLength)\n}\n", "import { allocUnsafe } from '#alloc'\nimport { asUint8Array } from '#util/as-uint8array'\n\n/**\n * Returns a new Uint8Array created by concatenating the passed Uint8Arrays\n */\nexport function concat (arrays: Uint8Array[], length?: number): Uint8Array<ArrayBuffer> {\n if (length == null) {\n length = arrays.reduce((acc, curr) => acc + curr.length, 0)\n }\n\n const output = allocUnsafe(length)\n let offset = 0\n\n for (const arr of arrays) {\n output.set(arr, offset)\n offset += arr.length\n }\n\n return asUint8Array(output)\n}\n", "/**\n * Returns true if the two passed Uint8Arrays have the same content\n */\nexport function equals (a: Uint8Array, b: Uint8Array): boolean {\n if (a === b) {\n return true\n }\n\n if (a.byteLength !== b.byteLength) {\n return false\n }\n\n for (let i = 0; i < a.byteLength; i++) {\n if (a[i] !== b[i]) {\n return false\n }\n }\n\n return true\n}\n"],
|
|
5
|
+
"mappings": ";kcAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,qBAAAC,ICIM,SAAUC,EAAOC,EAAe,EAAC,CACrC,OAAO,IAAI,WAAWA,CAAI,CAC5B,CAOM,SAAUC,EAAaD,EAAe,EAAC,CAC3C,OAAO,IAAI,WAAWA,CAAI,CAC5B,CCfA,SAASE,EAA4BC,EAAc,CACjD,OAAOA,GAAG,kBAAkB,WAC9B,CAMM,SAAUC,EAAcC,EAAe,CAC3C,GAAIH,EAA2BG,CAAG,EAChC,OAAOA,EAGT,IAAMF,EAAIE,EAAI,MAAK,EAEnB,OAAO,IAAI,WAAWF,EAAE,OAAQ,EAAGA,EAAE,UAAU,CACjD,CCVM,SAAUG,EAAQC,EAAsBC,EAAe,CACvDA,GAAU,OACZA,EAASD,EAAO,OAAO,CAACE,EAAKC,IAASD,EAAMC,EAAK,OAAQ,CAAC,GAG5D,IAAMC,EAASC,EAAYJ,CAAM,EAC7BK,EAAS,EAEb,QAAWC,KAAOP,EAChBI,EAAO,IAAIG,EAAKD,CAAM,EACtBA,GAAUC,EAAI,OAGhB,OAAOC,EAAaJ,CAAM,CAC5B,CCjBM,SAAUK,EAAQC,EAAeC,EAAa,CAClD,GAAID,IAAMC,EACR,MAAO,GAGT,GAAID,EAAE,aAAeC,EAAE,WACrB,MAAO,GAGT,QAASC,EAAI,EAAGA,EAAIF,EAAE,WAAYE,IAChC,GAAIF,EAAEE,CAAC,IAAMD,EAAEC,CAAC,EACd,MAAO,GAIX,MAAO,EACT,CJmEA,IAAMC,EAAS,OAAO,IAAI,6BAA6B,EAIvD,SAASC,EAAkBC,EAAoBC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C,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAU,EAC/D,WAAW,EAAGG,EAAO+B,CAAY,EAEtC,KAAK,MAAMlC,EAAKgC,CAAU,CAC5B,CAEA,WAAYA,EAAoBE,EAAsB,CACpD,IAAMlC,EAAM,KAAK,SAASgC,EAAYA,EAAa,CAAC,EAGpD,OAFa,IAAI,SAAShC,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAU,EAExD,WAAW,EAAGkC,CAAY,CACxC,CAEA,WAAYF,EAAoB7B,EAAe+B,EAAsB,CACnE,IAAMlC,EAAMmC,EAAM,CAAC,EACN,IAAI,SAASnC,EAAI,OAAQA,EAAI,WAAYA,EAAI,UAAU,EAC/D,WAAW,EAAGG,EAAO+B,CAAY,EAEtC,KAAK,MAAMlC,EAAKgC,CAAU,CAC5B,CAEA,OAAQI,EAAU,CAShB,GARIA,GAAS,MAIT,EAAEA,aAAiB/B,IAInB+B,EAAM,KAAK,SAAW,KAAK,KAAK,OAClC,MAAO,GAGT,QAAS1B,EAAI,EAAGA,EAAI,KAAK,KAAK,OAAQA,IACpC,GAAI,CAAC2B,EAAO,KAAK,KAAK3B,CAAC,EAAG0B,EAAM,KAAK1B,CAAC,CAAC,EACrC,MAAO,GAIX,MAAO,EACT,CAMA,OAAO,gBAA6Cb,EAAuBU,EAAe,CACxF,IAAMQ,EAAO,IAAIV,EACjB,OAAAU,EAAK,KAAOlB,EAERU,GAAU,OACZA,EAASV,EAAK,OAAO,CAACyC,EAAKC,IAASD,EAAMC,EAAK,WAAY,CAAC,GAG9DxB,EAAK,OAASR,EAEPQ,CACT",
|
|
6
|
+
"names": ["index_exports", "__export", "Uint8ArrayList", "isUint8ArrayList", "alloc", "size", "allocUnsafe", "isByteArrayWithArrayBuffer", "b", "asUint8Array", "buf", "concat", "arrays", "length", "acc", "curr", "output", "allocUnsafe", "offset", "arr", "asUint8Array", "equals", "a", "b", "i", "symbol", "findBufAndOffset", "bufs", "index", "offset", "buf", "bufEnd", "isUint8ArrayList", "value", "Uint8ArrayList", "_Uint8ArrayList", "data", "length", "chunk", "res", "i", "bytes", "beginInclusive", "endExclusive", "concat", "list", "bufStart", "sliceStartInBuf", "sliceEndsInBuf", "start", "search", "needle", "M", "radix", "rightmostPositions", "c", "j", "right", "lastIndex", "lastPatIndex", "skip", "char", "byteOffset", "allocUnsafe", "littleEndian", "alloc", "other", "equals", "acc", "curr"]
|
|
7
7
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
declare const symbol: unique symbol;
|
|
2
|
-
export type Appendable = Uint8ArrayList | Uint8Array
|
|
2
|
+
export type Appendable<T extends ArrayBufferLike = ArrayBuffer> = Uint8ArrayList<T> | Uint8Array<T>;
|
|
3
3
|
/**
|
|
4
4
|
* Check if object is a CID instance
|
|
5
5
|
*
|
|
@@ -14,29 +14,29 @@ export type Appendable = Uint8ArrayList | Uint8Array;
|
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
16
|
export declare function isUint8ArrayList(value: any): value is Uint8ArrayList;
|
|
17
|
-
export declare class Uint8ArrayList implements Iterable<Uint8Array
|
|
17
|
+
export declare class Uint8ArrayList<T extends ArrayBufferLike = ArrayBufferLike> implements Iterable<Uint8Array<T>> {
|
|
18
18
|
private bufs;
|
|
19
19
|
length: number;
|
|
20
20
|
readonly [symbol] = true;
|
|
21
|
-
constructor(...data: Appendable[]);
|
|
22
|
-
[Symbol.iterator](): Iterator<Uint8Array
|
|
21
|
+
constructor(...data: Appendable<T>[]);
|
|
22
|
+
[Symbol.iterator](): Iterator<Uint8Array<T>>;
|
|
23
23
|
get byteLength(): number;
|
|
24
24
|
/**
|
|
25
25
|
* Add one or more `bufs` to the end of this Uint8ArrayList
|
|
26
26
|
*/
|
|
27
|
-
append(...bufs: Appendable[]): void;
|
|
27
|
+
append(...bufs: Appendable<T>[]): void;
|
|
28
28
|
/**
|
|
29
29
|
* Add all `bufs` to the end of this Uint8ArrayList
|
|
30
30
|
*/
|
|
31
|
-
appendAll(bufs: Appendable[]): void;
|
|
31
|
+
appendAll(bufs: Appendable<T>[]): void;
|
|
32
32
|
/**
|
|
33
33
|
* Add one or more `bufs` to the start of this Uint8ArrayList
|
|
34
34
|
*/
|
|
35
|
-
prepend(...bufs: Appendable[]): void;
|
|
35
|
+
prepend(...bufs: Appendable<T>[]): void;
|
|
36
36
|
/**
|
|
37
37
|
* Add all `bufs` to the start of this Uint8ArrayList
|
|
38
38
|
*/
|
|
39
|
-
prependAll(bufs: Appendable[]): void;
|
|
39
|
+
prependAll(bufs: Appendable<T>[]): void;
|
|
40
40
|
/**
|
|
41
41
|
* Read the value at `index`
|
|
42
42
|
*/
|
|
@@ -48,7 +48,7 @@ export declare class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
48
48
|
/**
|
|
49
49
|
* Copy bytes from `buf` to the index specified by `offset`
|
|
50
50
|
*/
|
|
51
|
-
write(buf: Appendable
|
|
51
|
+
write(buf: Appendable<T | ArrayBuffer>, offset?: number): void;
|
|
52
52
|
/**
|
|
53
53
|
* Remove bytes from the front of the pool
|
|
54
54
|
*/
|
|
@@ -59,20 +59,20 @@ export declare class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
59
59
|
* This is a copy operation as it is with Uint8Arrays and Arrays
|
|
60
60
|
* - note this is different to the behaviour of Node Buffers.
|
|
61
61
|
*/
|
|
62
|
-
slice(beginInclusive?: number, endExclusive?: number): Uint8Array
|
|
62
|
+
slice(beginInclusive?: number, endExclusive?: number): Uint8Array<ArrayBuffer>;
|
|
63
63
|
/**
|
|
64
64
|
* Returns a alloc from the given start and end element index.
|
|
65
65
|
*
|
|
66
66
|
* In the best case where the data extracted comes from a single Uint8Array
|
|
67
67
|
* internally this is a no-copy operation otherwise it is a copy operation.
|
|
68
68
|
*/
|
|
69
|
-
subarray(beginInclusive?: number, endExclusive?: number): Uint8Array
|
|
69
|
+
subarray(beginInclusive?: number, endExclusive?: number): Uint8Array<T | ArrayBuffer>;
|
|
70
70
|
/**
|
|
71
71
|
* Returns a new Uint8ArrayList from the given start and end element index.
|
|
72
72
|
*
|
|
73
73
|
* This is a no-copy operation.
|
|
74
74
|
*/
|
|
75
|
-
sublist(beginInclusive?: number, endExclusive?: number): Uint8ArrayList
|
|
75
|
+
sublist(beginInclusive?: number, endExclusive?: number): Uint8ArrayList<T>;
|
|
76
76
|
private _subList;
|
|
77
77
|
indexOf(search: Uint8ArrayList | Uint8Array, offset?: number): number;
|
|
78
78
|
getInt8(byteOffset: number): number;
|
|
@@ -100,7 +100,7 @@ export declare class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
100
100
|
* Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this
|
|
101
101
|
* method if you know the total size of all the Uint8Arrays ahead of time.
|
|
102
102
|
*/
|
|
103
|
-
static fromUint8Arrays(bufs: Uint8Array[], length?: number): Uint8ArrayList
|
|
103
|
+
static fromUint8Arrays<T extends ArrayBufferLike>(bufs: Uint8Array<T>[], length?: number): Uint8ArrayList<T>;
|
|
104
104
|
}
|
|
105
105
|
export {};
|
|
106
106
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAsFA,QAAA,MAAM,MAAM,eAA4C,CAAA;AAExD,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAsFA,QAAA,MAAM,MAAM,eAA4C,CAAA;AAExD,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,eAAe,GAAG,WAAW,IAAI,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;AAyBnG;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAAE,GAAG,GA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8arraylist",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Append and consume bytes using only no-copy operations",
|
|
5
5
|
"author": "Alex Potsides <alex@achingbrain.net>",
|
|
6
6
|
"license": "Apache-2.0 OR MIT",
|
|
@@ -140,12 +140,12 @@
|
|
|
140
140
|
"docs": "aegir docs"
|
|
141
141
|
},
|
|
142
142
|
"dependencies": {
|
|
143
|
-
"uint8arrays": "^
|
|
143
|
+
"uint8arrays": "^6.0.0"
|
|
144
144
|
},
|
|
145
145
|
"devDependencies": {
|
|
146
|
-
"aegir": "^
|
|
146
|
+
"aegir": "^48.0.1",
|
|
147
147
|
"benchmark": "^2.1.4",
|
|
148
|
-
"bl": "^
|
|
148
|
+
"bl": "^7.0.2",
|
|
149
149
|
"it-all": "^3.0.4"
|
|
150
150
|
}
|
|
151
151
|
}
|
package/src/index.ts
CHANGED
|
@@ -86,7 +86,7 @@ import { equals } from 'uint8arrays/equals'
|
|
|
86
86
|
|
|
87
87
|
const symbol = Symbol.for('@achingbrain/uint8arraylist')
|
|
88
88
|
|
|
89
|
-
export type Appendable = Uint8ArrayList | Uint8Array
|
|
89
|
+
export type Appendable<T extends ArrayBufferLike = ArrayBuffer> = Uint8ArrayList<T> | Uint8Array<T>
|
|
90
90
|
|
|
91
91
|
function findBufAndOffset (bufs: Uint8Array[], index: number): { buf: Uint8Array, index: number } {
|
|
92
92
|
if (index == null || index < 0) {
|
|
@@ -128,12 +128,12 @@ export function isUint8ArrayList (value: any): value is Uint8ArrayList {
|
|
|
128
128
|
return Boolean(value?.[symbol])
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export class Uint8ArrayList implements Iterable<Uint8Array
|
|
132
|
-
private bufs: Uint8Array[]
|
|
131
|
+
export class Uint8ArrayList <T extends ArrayBufferLike = ArrayBufferLike> implements Iterable<Uint8Array<T>> {
|
|
132
|
+
private bufs: Uint8Array<T>[]
|
|
133
133
|
public length: number
|
|
134
134
|
public readonly [symbol] = true
|
|
135
135
|
|
|
136
|
-
constructor (...data: Appendable[]) {
|
|
136
|
+
constructor (...data: Appendable<T>[]) {
|
|
137
137
|
this.bufs = []
|
|
138
138
|
this.length = 0
|
|
139
139
|
|
|
@@ -142,7 +142,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
* [Symbol.iterator] (): Iterator<Uint8Array
|
|
145
|
+
* [Symbol.iterator] (): Iterator<Uint8Array<T>> {
|
|
146
146
|
yield * this.bufs
|
|
147
147
|
}
|
|
148
148
|
|
|
@@ -153,14 +153,14 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
153
153
|
/**
|
|
154
154
|
* Add one or more `bufs` to the end of this Uint8ArrayList
|
|
155
155
|
*/
|
|
156
|
-
append (...bufs: Appendable[]): void {
|
|
156
|
+
append (...bufs: Appendable<T>[]): void {
|
|
157
157
|
this.appendAll(bufs)
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
/**
|
|
161
161
|
* Add all `bufs` to the end of this Uint8ArrayList
|
|
162
162
|
*/
|
|
163
|
-
appendAll (bufs: Appendable[]): void {
|
|
163
|
+
appendAll (bufs: Appendable<T>[]): void {
|
|
164
164
|
let length = 0
|
|
165
165
|
|
|
166
166
|
for (const buf of bufs) {
|
|
@@ -183,14 +183,14 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
183
183
|
/**
|
|
184
184
|
* Add one or more `bufs` to the start of this Uint8ArrayList
|
|
185
185
|
*/
|
|
186
|
-
prepend (...bufs: Appendable[]): void {
|
|
186
|
+
prepend (...bufs: Appendable<T>[]): void {
|
|
187
187
|
this.prependAll(bufs)
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
/**
|
|
191
191
|
* Add all `bufs` to the start of this Uint8ArrayList
|
|
192
192
|
*/
|
|
193
|
-
prependAll (bufs: Appendable[]): void {
|
|
193
|
+
prependAll (bufs: Appendable<T>[]): void {
|
|
194
194
|
let length = 0
|
|
195
195
|
|
|
196
196
|
for (const buf of bufs.reverse()) {
|
|
@@ -229,7 +229,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
229
229
|
/**
|
|
230
230
|
* Copy bytes from `buf` to the index specified by `offset`
|
|
231
231
|
*/
|
|
232
|
-
write (buf: Appendable
|
|
232
|
+
write (buf: Appendable<T | ArrayBuffer>, offset: number = 0): void {
|
|
233
233
|
if (buf instanceof Uint8Array) {
|
|
234
234
|
for (let i = 0; i < buf.length; i++) {
|
|
235
235
|
this.set(offset + i, buf[i])
|
|
@@ -281,7 +281,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
281
281
|
* This is a copy operation as it is with Uint8Arrays and Arrays
|
|
282
282
|
* - note this is different to the behaviour of Node Buffers.
|
|
283
283
|
*/
|
|
284
|
-
slice (beginInclusive?: number, endExclusive?: number): Uint8Array {
|
|
284
|
+
slice (beginInclusive?: number, endExclusive?: number): Uint8Array<ArrayBuffer> {
|
|
285
285
|
const { bufs, length } = this._subList(beginInclusive, endExclusive)
|
|
286
286
|
|
|
287
287
|
return concat(bufs, length)
|
|
@@ -293,7 +293,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
293
293
|
* In the best case where the data extracted comes from a single Uint8Array
|
|
294
294
|
* internally this is a no-copy operation otherwise it is a copy operation.
|
|
295
295
|
*/
|
|
296
|
-
subarray (beginInclusive?: number, endExclusive?: number): Uint8Array {
|
|
296
|
+
subarray (beginInclusive?: number, endExclusive?: number): Uint8Array<T | ArrayBuffer> {
|
|
297
297
|
const { bufs, length } = this._subList(beginInclusive, endExclusive)
|
|
298
298
|
|
|
299
299
|
if (bufs.length === 1) {
|
|
@@ -308,10 +308,10 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
308
308
|
*
|
|
309
309
|
* This is a no-copy operation.
|
|
310
310
|
*/
|
|
311
|
-
sublist (beginInclusive?: number, endExclusive?: number): Uint8ArrayList {
|
|
311
|
+
sublist (beginInclusive?: number, endExclusive?: number): Uint8ArrayList<T> {
|
|
312
312
|
const { bufs, length } = this._subList(beginInclusive, endExclusive)
|
|
313
313
|
|
|
314
|
-
const list = new Uint8ArrayList()
|
|
314
|
+
const list = new Uint8ArrayList<T>()
|
|
315
315
|
list.length = length
|
|
316
316
|
// don't loop, just set the bufs
|
|
317
317
|
list.bufs = bufs
|
|
@@ -319,7 +319,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
319
319
|
return list
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
private _subList (beginInclusive?: number, endExclusive?: number): { bufs: Uint8Array[], length: number } {
|
|
322
|
+
private _subList (beginInclusive?: number, endExclusive?: number): { bufs: Uint8Array<T>[], length: number } {
|
|
323
323
|
beginInclusive = beginInclusive ?? 0
|
|
324
324
|
endExclusive = endExclusive ?? this.length
|
|
325
325
|
|
|
@@ -343,7 +343,7 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
343
343
|
return { bufs: [...this.bufs], length: this.length }
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
-
const bufs: Uint8Array[] = []
|
|
346
|
+
const bufs: Uint8Array<T>[] = []
|
|
347
347
|
let offset = 0
|
|
348
348
|
|
|
349
349
|
for (let i = 0; i < this.bufs.length; i++) {
|
|
@@ -657,8 +657,8 @@ export class Uint8ArrayList implements Iterable<Uint8Array> {
|
|
|
657
657
|
* Create a Uint8ArrayList from a pre-existing list of Uint8Arrays. Use this
|
|
658
658
|
* method if you know the total size of all the Uint8Arrays ahead of time.
|
|
659
659
|
*/
|
|
660
|
-
static fromUint8Arrays (bufs: Uint8Array[], length?: number): Uint8ArrayList {
|
|
661
|
-
const list = new Uint8ArrayList()
|
|
660
|
+
static fromUint8Arrays <T extends ArrayBufferLike> (bufs: Uint8Array<T>[], length?: number): Uint8ArrayList<T> {
|
|
661
|
+
const list = new Uint8ArrayList<T>()
|
|
662
662
|
list.bufs = bufs
|
|
663
663
|
|
|
664
664
|
if (length == null) {
|