# ab-neuter

> Neuter any Typed Array or ArrayBuffer

Latest version **0.1.3** (published 2017-03-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install ab-neuter
pnpm add ab-neuter
yarn add ab-neuter
bun add ab-neuter
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2017-03-31 |
| First published | 2017-02-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | NodeSource |
| Maintainers | trev.norris |
| Keywords | buffer, arraybuffer, neuter |

## Links

- npm: https://www.npmjs.com/package/ab-neuter
- npm.io page: https://npm.io/package/ab-neuter

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2017-03-31
- 0.1.2 — 2017-03-31
- 0.1.1 — 2017-03-30
- 0.1.0 — 2017-02-03

## README

## `ArrayBuffer` Neuter

Remove the underlying data from an `ArrayBuffer` and free the memory manually.
For safety, only `ArrayBuffer`s that have not been externalized can be
neutered.


### Install

```
$ npm install ab-neuter
```

### Usage

```js
const neuter = require('ab-neuter');
const net = require('net');

net.createServer((c) => {
  c.on('data', (chunk) => {
    // Perform operation on the Buffer, then manually free the memory.
    neuter(chunk);
  });
}).listen();
```

### Benchmarks

The included benchmark creates a TCP server and client as a child process then
pumps as much data through as possible. Every three seconds it will print the
amount of Gbit/sec that have been transferred from the client to the server.
Run it using:

```
$ node benchmark/bench-net.js
```

By default the transferred `Buffer` will be neutered in the `'data'` callback.
To disable neutering pass `--no-neuter`:

```
$ node benchmark/bench-net.js --no-neuter
```

The benchmark has been optimized to show the maximum difference between the
two, and at the moment there's no way to change the parameters from the command
line.

---
_Source: https://npm.io/package/ab-neuter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
