TypedDeque

Codecov npm GitHub

Variable length TypedArray that is implemented with an array of TypedArray.

  • Work in browser, Node.js and Deno
  • Support TypeScript out of the box
  • No external dependencies
  • Ideal to parse chunks of binary data

Installation

If you are using npm:

npm install typeddeque
import { Uint8Deque } from "typeddeque";
const buf = new Uint8Deque();

For vanilla HTML in modern browsers:

<script type="module">
  import { Uint8Deque } from "https://cdn.skypack.dev/typeddeque";
  const buf = new Uint8Deque();
</script>

With Deno:

import { Uint8Deque } from "https://deno.land/x/typeddeque/mod.ts";
const buf = new Uint8Deque();

Basic Usage

import { Uint8Deque } from "typeddeque";

const buf = new Uint8Deque();

buf.push(new Uint8Array([1, 2]));
buf.push(new Buffer([3, 4, 5]));

console.log(buf.slice(1, 3));
// Uint8Array(2) [ 2, 3 ]

API Documentation

Available on deno doc.