Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chunkosaurus

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunkosaurus - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

14

dist/chunkosaurus.es5.js

@@ -519,3 +519,3 @@ /*! *****************************************************************************

_this.addListener('chunk', function (chunk) {
if (!chunk || !chunk.id || !chunk.chunk || !chunk.chunks || !chunk.data) {
if (!isChunk(chunk)) {
console.warn("Chunkosaurus received non-chunk data " + chunk);

@@ -551,4 +551,14 @@ return;

}
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
function isChunk(chunk) {
return (!!chunk &&
typeof chunk === 'object' &&
typeof chunk.id === 'string' &&
typeof chunk.chunks === 'number' &&
typeof chunk.chunk === 'number' &&
typeof chunk.data === 'string');
}
export { Chunkosaurus, chunkify };
export { Chunkosaurus, chunkify, isChunk };
//# sourceMappingURL=chunkosaurus.es5.js.map

@@ -525,3 +525,3 @@ (function (global, factory) {

_this.addListener('chunk', function (chunk) {
if (!chunk || !chunk.id || !chunk.chunk || !chunk.chunks || !chunk.data) {
if (!isChunk(chunk)) {
console.warn("Chunkosaurus received non-chunk data " + chunk);

@@ -557,5 +557,16 @@ return;

}
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
function isChunk(chunk) {
return (!!chunk &&
typeof chunk === 'object' &&
typeof chunk.id === 'string' &&
typeof chunk.chunks === 'number' &&
typeof chunk.chunk === 'number' &&
typeof chunk.data === 'string');
}
exports.Chunkosaurus = Chunkosaurus;
exports.chunkify = chunkify;
exports.isChunk = isChunk;

@@ -562,0 +573,0 @@ Object.defineProperty(exports, '__esModule', { value: true });

@@ -18,3 +18,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.chunkify = exports.Chunkosaurus = void 0;
exports.isChunk = exports.chunkify = exports.Chunkosaurus = void 0;
var events_1 = require("events");

@@ -42,3 +42,3 @@ var Chunkosaurus = /** @class */ (function (_super) {

_this.addListener('chunk', function (chunk) {
if (!chunk || !chunk.id || !chunk.chunk || !chunk.chunks || !chunk.data) {
if (!isChunk(chunk)) {
console.warn("Chunkosaurus received non-chunk data " + chunk);

@@ -76,2 +76,13 @@ return;

exports.chunkify = chunkify;
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
function isChunk(chunk) {
return (!!chunk &&
typeof chunk === 'object' &&
typeof chunk.id === 'string' &&
typeof chunk.chunks === 'number' &&
typeof chunk.chunk === 'number' &&
typeof chunk.data === 'string');
}
exports.isChunk = isChunk;
//# sourceMappingURL=chunkosaurus.js.map

@@ -16,1 +16,2 @@ /// <reference types="node" />

export declare function chunkify(data: string, size: number): Chunk[];
export declare function isChunk(chunk: any): chunk is Chunk;

2

package.json
{
"name": "chunkosaurus",
"version": "0.0.1",
"version": "0.0.2",
"description": "Easy to understand arbitrary data chunker",

@@ -5,0 +5,0 @@ "keywords": [],

@@ -44,2 +44,6 @@ # chunkosaurus

An `EventEmitter` class that receives `chunk` events, and spits out `data` events
after it's processed all of the chunks in a piece of data. You can also call
`.feedChunk(chunk)`, it's identical to `.emit('chunk', chunk)`.
```js

@@ -58,2 +62,20 @@ import { Chunkosaurus, chunks } from 'chunkosaurus';

c.emit('chunk', chunks[2]); // Emit 'data', console will show "Full data: some data here"
```
### `isChunk`
Utility function for determining if an object is a chunk. Useful for streams where you
only want to chunk large data, but want to send smaller bits of data as-is.
```js
// true
isChunk({
id: '2b518fa0-6157-4165-aeb4-c93db2710f1a',
chunks: 3,
chunk: 1,
data: 'some data here'
});
// false
isChunk('some data here');
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc