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 0.1.0 to 0.2.0

24

lib/mjpeg-consumer.js
require("buffertools");
var length = /Content-Length: \d+\s*/;
var length = /Content-Length: \d+/;
var soi = new Buffer(2);
soi.writeUInt16LE(0xd8ff, 0);

@@ -17,4 +19,3 @@ var MjpegConsumer = function() {

MjpegConsumer.prototype.write = function(chunk) {
var len = length.exec(chunk);
var start, initialBytes, remaining;
var len, start, initialBytes, remaining, soiIndex;

@@ -24,3 +25,6 @@ if (chunk.length < this.totalBytes - this.bytesWritten) {

this.bytesWritten += chunk.length;
} else if (this.initialized && this.bytesWritten < this.totalBytes) {
return;
}
if (this.initialized && this.bytesWritten < this.totalBytes) {
remaining = this.totalBytes - this.bytesWritten

@@ -31,2 +35,3 @@ chunk.copy(this.buffer, this.bytesWritten, 0, remaining);

len = length.exec(chunk);
if (len) {

@@ -40,6 +45,9 @@ if (this.initialized) {

this.totalBytes = Number(/\d+/.exec(len[0]));
this.buffer = new Buffer(this.totalBytes);
start = chunk.indexOf("Content-Length");
initialBytes = (chunk.length - (start + len[0].length));
chunk.copy(this.buffer, 0, start + len[0].length, chunk.length);
this.buffer = new Buffer(this.totalBytes);
}
start = chunk.indexOf(soi);
if (start !== -1) {
initialBytes = (chunk.length - start);
chunk.copy(this.buffer, 0, start, chunk.length);
this.bytesWritten += initialBytes;

@@ -46,0 +54,0 @@ }

{
"name": "mjpeg-consumer",
"version": "0.1.0",
"version": "0.2.0",
"description": "a nodejs stream implementation that consumes http mjpeg streams",

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

"author": "Mike Maelzer <mmaelzer@gmail.com>",
"license": "BSD"
"license": "BSD",
"keywords": ["mjpg", "mjpeg", "motion jpeg", "stream", "http", "ip camera"]
}

@@ -15,4 +15,2 @@ mjpeg-consumer

**MjpegConsumer()**
var MjpegConsumer = require("mjpeg-consumer");

@@ -26,3 +24,3 @@ var consumer = new MjpegConsumer();

var request = require("request");
var MjpegConsumer = require("../lib/mjpeg-consumer");
var MjpegConsumer = require("mjpeg-consumer");
var FileOnWrite = require("file-on-write");

@@ -29,0 +27,0 @@

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