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

length-prefixed-message

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

length-prefixed-message - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

example.js

7

index.js

@@ -9,2 +9,3 @@ var varint = require('varint');

var msglen = 0;
var prev = null;
var readable = function() {

@@ -14,2 +15,6 @@ if (!msglen) {

if (!buf) return;
if (prev) {
buf = Buffer.concat([prev, buf]);
prev = null;
}

@@ -23,3 +28,3 @@ for (var i = 0; i < buf.length; i++) {

if (!msglen) {
stream.unshift(buf);
prev = buf;
return;

@@ -26,0 +31,0 @@ }

5

package.json
{
"name": "length-prefixed-message",
"version": "3.0.1",
"version": "3.0.2",
"description": "Reads and writes binary length prefixed messages. ",

@@ -26,3 +26,4 @@ "main": "index.js",

"tape": "^2.14.0",
"concat-stream": "^1.4.6"
"concat-stream": "^1.4.6",
"choppa": "^1.0.0"
},

@@ -29,0 +30,0 @@ "dependencies": {

@@ -5,2 +5,3 @@ var fs = require('fs');

var lpm = require('./');
var choppa = require('choppa');
var varint = require('varint');

@@ -15,2 +16,11 @@

test('.read with chunked stream', function(t) {
var chp = choppa();
fs.createReadStream('./fixtures2').pipe(chp);
lpm.read(chp, function(buf) {
t.equal(buf.toString().substr(0, 33), 'As Gregor Samsa awoke one morning');
t.end();
});
});
test('.write', function(t) {

@@ -17,0 +27,0 @@ var stream = concat(function(buff) {

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