npm.io
0.0.2 • Published 7 years ago

@timvanscherpenzeel/typedarray-pool

Licence
MIT
Version
0.0.2
Deps
0
Size
218 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated

TypedArray pool

npm version dependencies devDependencies

A global pool for typed arrays (923 B).

This library is a modern TypeScript port of the original typedarray-pool library by Mikola Lysenko with some API changes.

Installation

Make sure you have Node.js installed.

 $ npm install @timvanscherpenzeel/typedarray-pool

Usage

import { TypedArrayPool } from '@timvanscherpenzeel/typedarray-pool';

const typedArrayPool = new TypedArrayPool();

// Allocate a buffer with at least 128 floats
const f = typedArrayPool.malloc(128, 'FLOAT_32');

// ...

// When done, release buffer back to pool
typedArrayPool.free(f);

Development

$ yarn start

$ yarn lint

$ yarn test

$ yarn build

Licence

My work is released under the MIT license.