
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
@metarouter/partitioned-buffer
Advanced tools
A class that encapsulates several sub-buffers that are partitioned by a specified key
Partitioned buffer is an object that maintains an internal list of sub buffers partitioned by a key you specify. Each sub buffer can store its own separate data and emit the data according to criteria you specify.
npm install astronomerio/partitioned-buffer#1.0.0
Import the main class from 'partitioned-buffer' and instantiate it with a "flush" callback that will be invoked any time an internal buffer emits its data. The callback function is fit to handle returning a Promise or be marked as 'async'.
import PartitionedBuffer from '@astronomerio/partitioned-buffer';
const partitionedBuffer = new PartitionedBuffer(function (data, key) {
// do something with data, such as put to s3
// data is the array of all the records you pushed onto the buffer
// key is the key by which this buffer was partitioned
});
You can optionally pass in an options object as the second parameter in the constructor. The options specify the criteria for when an internal buffer will emit its data.
const options = {
maxBytesPerFlush: 500000,
maxRecordsPerFlush: 500,
maxMillisPerFlush = 300000 // 5 minutes
};
Simply call partitionedBuffer.push(key, data) and supply a key that will reference the internal buffer which stores the data. The partitioned buffer does not perform any transormations on the data, it will emit the exact data you passed in.
partitionedBuffer.push('h2jkl345hl', { event_name: 'track', timestamp: '09/22/2016' });
© Copyright Astronomer, Inc 2016
You may use, copy and redistribute this library under the MIT license.
FAQs
A class that encapsulates several sub-buffers that are partitioned by a specified key
The npm package @metarouter/partitioned-buffer receives a total of 2 weekly downloads. As such, @metarouter/partitioned-buffer popularity was classified as not popular.
We found that @metarouter/partitioned-buffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.