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

bytestreamjs

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytestreamjs - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

58

build/cjs/seq_stream.js

@@ -5,2 +5,3 @@ "use strict";

const byte_stream_1 = require("./byte_stream");
const pow2_24 = 16777216;
class SeqStream {

@@ -392,51 +393,36 @@ constructor(parameters = {}) {

return 0;
const value = new Uint16Array(1);
const view = new Uint8Array(value.buffer);
view[0] = block[1];
view[1] = block[0];
return value[0];
return (block[0] << 8) | block[1];
}
getInt16(changeLength = true) {
const block = this.getBlock(2, changeLength);
if (block.length < 2)
return 0;
const value = new Int16Array(1);
const view = new Uint8Array(value.buffer);
view[0] = block[1];
view[1] = block[0];
return value[0];
const num = this.getUint16(changeLength);
const negative = 0x8000;
if (num & negative) {
return -(negative - (num ^ negative));
}
return num;
}
getUint24(changeLength = true) {
const block = this.getBlock(3, changeLength);
const block = this.getBlock(4, changeLength);
if (block.length < 3)
return 0;
const value = new Uint32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 1; i--) {
view[3 - i] = block[i - 1];
}
return value[0];
return (block[0] << 16) |
(block[1] << 8) |
block[2];
}
getUint32(changeLength = true) {
const block = this.getBlock(4, changeLength);
if (block.length < 4) {
if (block.length < 4)
return 0;
}
const value = new Uint32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 0; i--) {
view[3 - i] = block[i];
}
return value[0];
return (block[0] * pow2_24) +
(block[1] << 16) +
(block[2] << 8) +
block[3];
}
getInt32(changeLength = true) {
const block = this.getBlock(4, changeLength);
if (block.length < 4)
return 0;
const value = new Int32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 0; i--) {
view[3 - i] = block[i];
const num = this.getUint32(changeLength);
const negative = 0x80000000;
if (num & negative) {
return -(negative - (num ^ negative));
}
return value[0];
return num;
}

@@ -443,0 +429,0 @@ beforeAppend(size) {

import { ByteStream } from "./byte_stream";
const pow2_24 = 16777216;
export class SeqStream {

@@ -388,51 +389,36 @@ constructor(parameters = {}) {

return 0;
const value = new Uint16Array(1);
const view = new Uint8Array(value.buffer);
view[0] = block[1];
view[1] = block[0];
return value[0];
return (block[0] << 8) | block[1];
}
getInt16(changeLength = true) {
const block = this.getBlock(2, changeLength);
if (block.length < 2)
return 0;
const value = new Int16Array(1);
const view = new Uint8Array(value.buffer);
view[0] = block[1];
view[1] = block[0];
return value[0];
const num = this.getUint16(changeLength);
const negative = 0x8000;
if (num & negative) {
return -(negative - (num ^ negative));
}
return num;
}
getUint24(changeLength = true) {
const block = this.getBlock(3, changeLength);
const block = this.getBlock(4, changeLength);
if (block.length < 3)
return 0;
const value = new Uint32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 1; i--) {
view[3 - i] = block[i - 1];
}
return value[0];
return (block[0] << 16) |
(block[1] << 8) |
block[2];
}
getUint32(changeLength = true) {
const block = this.getBlock(4, changeLength);
if (block.length < 4) {
if (block.length < 4)
return 0;
}
const value = new Uint32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 0; i--) {
view[3 - i] = block[i];
}
return value[0];
return (block[0] * pow2_24) +
(block[1] << 16) +
(block[2] << 8) +
block[3];
}
getInt32(changeLength = true) {
const block = this.getBlock(4, changeLength);
if (block.length < 4)
return 0;
const value = new Int32Array(1);
const view = new Uint8Array(value.buffer);
for (let i = 3; i >= 0; i--) {
view[3 - i] = block[i];
const num = this.getUint32(changeLength);
const negative = 0x80000000;
if (num & negative) {
return -(negative - (num ^ negative));
}
return value[0];
return num;
}

@@ -439,0 +425,0 @@ beforeAppend(size) {

@@ -61,3 +61,3 @@ {

"name": "bytestreamjs",
"version": "2.0.0",
"version": "2.0.1",
"module": "./build/mjs/index.js",

@@ -64,0 +64,0 @@ "main": "./build/cjs/index.js",

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