Socket
Socket
Sign inDemoInstall

byte-data-stream

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

byte-data-stream - npm Package Compare versions

Comparing version 0.1.1-rokka0 to 0.1.2-rokka0

2

package.json
{
"name": "byte-data-stream",
"version": "0.1.1-rokka0",
"version": "0.1.2-rokka0",
"description": "Readable & writable byte data stream",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -12,2 +12,3 @@ const var_int = require('signed-varint');

this.view = new DataView(this.buf);
this.u8 = new Uint8Array(this.buf);
}

@@ -28,7 +29,10 @@

read_bytes(length){
let arr = [];
/*let arr = new Uint8Array(length);
for(let i = 0;i < length;i++){
arr.push(this.read_uint8());
arr[i] = this.read_uint8();
}*/
if(this.i+length > this.buf.byteLength){
throw new RangeError('Offset is outside the bounds of the ArrayBuffer');
}
return Uint8Array.from(arr);
return this.u8.subarray(this.i,this.i += length);
}

@@ -121,7 +125,7 @@

if(len <= 0) return;
let u8a1 = new Uint8Array(this.buf.byteLength+len);
let u8a2 = new Uint8Array(this.buf);
u8a1.set(u8a2);
this.buf = u8a1.buffer;
let u8 = new Uint8Array(this.buf.byteLength+len);
u8.set(new Uint8Array(this.buf));
this.buf = u8.buffer;
this.view = new DataView(this.buf);
this.u8 = u8;
}

@@ -140,5 +144,5 @@

write_bytes(bytes){
for(let n of bytes){
this.write_uint8(n);
}
this.expand_buffer(bytes.length);
this.u8.set(bytes,this.i);
this.i += bytes.length;
}

@@ -145,0 +149,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