Skip to main content

Built and signed on GitHub Actions

A high-performance PartitionedBuffer implementation backed by Uint32Array for efficient memory usage and fast bitwise operations.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (0.2.8)
type alias PartitionSpec

Partition specification

The partition creation instructions. Consisting of a PartitionMeta and a PartitionSchema object.

Examples

Example 1

// A schema:
type Vec2 = { x: number, y: number };
const partition: PartitionSpec<Vec2> = { name: "position", schema: { x: Float32Array, y: Float32Array } };

Example 2

// A tag:
const partition: PartitionSpec<null> = { name: "isAlive" };

Example 3

// A tag with a maximum number of owners:
const partition: PartitionSpec<null> = { name: "isSpecial", maxOwners: 100 };

Type Parameters

T extends SchemaSpec<T> | null = null

Definition

PartitionSchema<T> & PartitionMeta<T>

Add Package

deno add jsr:@phughesmcr/partitionedbuffer

Import symbol

import { type PartitionSpec } from "@phughesmcr/partitionedbuffer";

---- OR ----

Import directly with a jsr specifier

import { type PartitionSpec } from "jsr:@phughesmcr/partitionedbuffer";

Add Package

npx jsr add @phughesmcr/partitionedbuffer

Import symbol

import { type PartitionSpec } from "@phughesmcr/partitionedbuffer";

Add Package

yarn dlx jsr add @phughesmcr/partitionedbuffer

Import symbol

import { type PartitionSpec } from "@phughesmcr/partitionedbuffer";

Add Package

pnpm dlx jsr add @phughesmcr/partitionedbuffer

Import symbol

import { type PartitionSpec } from "@phughesmcr/partitionedbuffer";

Add Package

bunx jsr add @phughesmcr/partitionedbuffer

Import symbol

import { type PartitionSpec } from "@phughesmcr/partitionedbuffer";