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

mjpeg-consumer

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mjpeg-consumer - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

28

lib/mjpeg-consumer.js
var util = require('util');
var Transform = require('stream').Transform;
require("buffertools").extend();

@@ -8,8 +7,6 @@ var lengthRegex = /Content-Length:\s*(\d+)/i;

// Start of Image
var soi = new Buffer(2);
soi.writeUInt16LE(0xd8ff, 0);
var soi = Buffer.from([0xff, 0xd8]);
// End of Image
var eoi = new Buffer(2);
eoi.writeUInt16LE(0xd9ff, 0);
var eoi = Buffer.from([0xff, 0xd9]);

@@ -25,3 +22,2 @@ function MjpegConsumer(options) {

this.oldBufferType = process.version.split('.')[0] === 'v0';
this.reading = false;

@@ -43,9 +39,3 @@ this.contentLength = null;

this.contentLength = len;
this.buffer = new Buffer(len);
if (this.oldBufferType) {
this.buffer = new Buffer(0);
}
// Fill the buffer so we don't leak random bytes
// more info: https://nodejs.org/api/buffer.html#buffer_new_buffer_size
this.buffer.fill(0);
this.buffer = Buffer.alloc(len);
this.bytesWritten = 0;

@@ -63,7 +53,3 @@

if (this.oldBufferType) {
this.buffer = this.buffer.concat(chunk.slice(start, bufEnd));
} else {
chunk.copy(this.buffer, 0, start, bufEnd);
}
chunk.copy(this.buffer, 0, start, bufEnd);

@@ -90,7 +76,3 @@ this.bytesWritten = chunk.length - start;

if (this.oldBufferType) {
this.buffer = this.buffer.concat(chunk.slice(bufStart, bufEnd));
} else {
chunk.copy(this.buffer, this.bytesWritten, bufStart, bufEnd);
}
chunk.copy(this.buffer, this.bytesWritten, bufStart, bufEnd);

@@ -97,0 +79,0 @@ this.bytesWritten += bufEnd - bufStart;

13

package.json
{
"name": "mjpeg-consumer",
"version": "1.1.0",
"version": "2.0.0",
"description": "a stream implementation that consumes http mjpeg streams and emits jpegs as buffers",

@@ -10,14 +10,11 @@ "main": "index.js",

},
"dependencies": {
"buffertools": "~2.1.0"
},
"devDependencies": {
"coveralls": "^2.11.4",
"coveralls": "^2.13.3",
"file-on-write": "~0.2.0",
"jscoverage": "^0.6.0",
"nodeunit": "^0.9.1",
"request": "^2.67.0"
"nodeunit": "^0.11.3",
"request": "^2.88.0"
},
"engines": {
"node": ">=0.10.0"
"node": ">=8.0.0"
},

@@ -24,0 +21,0 @@ "repository": "https://github.com/mmaelzer/mjpeg-consumer",

@@ -76,5 +76,5 @@ var MjpegConsumer = (function(coverage) {

var consumer = new MjpegConsumer();
var buf = new Buffer("Content-Length: " + IMG.length + "\n\n");
var fhalfImg = new Buffer(500);
var shalfImg = new Buffer(IMG.length - 500);
var buf = Buffer.from("Content-Length: " + IMG.length + "\n\n");
var fhalfImg = Buffer.alloc(500);
var shalfImg = Buffer.alloc(IMG.length - 500);

@@ -99,5 +99,5 @@ IMG.copy(fhalfImg, 0, 0, fhalfImg.length);

var consumer = new MjpegConsumer();
var buf = new Buffer("Content-Length: " + IMG.length + "\n\n");
var fhalfImg = new Buffer(500);
var shalfImg = new Buffer(IMG.length - 500);
var buf = Buffer.from("Content-Length: " + IMG.length + "\n\n");
var fhalfImg = Buffer.alloc(500);
var shalfImg = Buffer.alloc(IMG.length - 500);

@@ -120,4 +120,4 @@ IMG.copy(fhalfImg, 0, 0, fhalfImg.length);

var chunkHeaders = new Buffer('Content-Type: image/jpeg\nContent-Length: '+ IMG.length + '\n\n');
var chunkBoundary = new Buffer(boundary + '\n');
var chunkHeaders = Buffer.from('Content-Type: image/jpeg\nContent-Length: '+ IMG.length + '\n\n');
var chunkBoundary = Buffer.from(boundary + '\n');

@@ -124,0 +124,0 @@ function getTestConsumer(t) {

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