Socket
Socket
Sign inDemoInstall

ab-neuter

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ab-neuter

Neuter any Typed Array or ArrayBuffer


Version published
Weekly downloads
2
decreased by-66.67%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

ArrayBuffer Neuter

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

Install

$ npm install ab-neuter

Usage

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.

Keywords

FAQs

Last updated on 31 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc