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

bytebuffer

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bytebuffer - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

docs/module-ByteBuffer.html

2

bower.json
{
"name": "bytebuffer",
"version": "2.0.1",
"version": "2.0.2",
"author": "Daniel Wirtz <dcode@dcode.io>",

@@ -5,0 +5,0 @@ "description": "A full-featured ByteBuffer implementation using typed arrays.",

@@ -7,4 +7,4 @@ /*

(function(m){function p(k){function c(a,b){a="undefined"!==typeof a?parseInt(a,10):c.DEFAULT_CAPACITY;1>a&&(a=c.DEFAULT_CAPACITY);this.array=3==arguments.length&&!0===arguments[2]?null:new ArrayBuffer(a);this.view=null!=this.array?new DataView(this.array):null;this.offset=0;this.markedOffset=-1;this.length=0;this.littleEndian="undefined"!=typeof b?!!b:!1}var n=null;if("function"===typeof require)try{var m=require("buffer"),n=m&&"function"===typeof m.Buffer&&"function"===typeof m.Buffer.isBuffer?m.Buffer:
null}catch(p){}c.VERSION="2.0.1";c.DEFAULT_CAPACITY=16;c.LITTLE_ENDIAN=!0;c.BIG_ENDIAN=!1;c.Long=k;c.allocate=function(a,b){return new c(a,b)};c.wrap=function(a,b,d){"boolean"===typeof b&&(d=b,b="utf8");if("string"===typeof a)switch(b){case "hex":return c.decodeHex(a,d);case "base64":return c.decode64(a,d);default:return(new c(c.DEFAULT_CAPACITY,d)).writeUTF8String(a).flip()}if(n&&n.isBuffer(a)){b=(new Uint8Array(a)).buffer;if(b===a){b=new ArrayBuffer(a.length);for(var e=new Uint8Array(b),f=0,g=a.length;f<
g;++f)e[f]=a[f]}a=b}if(null===a||"object"!==typeof a)throw Error("Cannot wrap null or non-object");if(a instanceof c)return a.clone();a.array?a=a.array:a.buffer&&(a=a.buffer);if(!(a instanceof ArrayBuffer))throw Error("Cannot wrap buffer of type "+typeof a+", "+a.constructor.name);b=new c(0,d,!0);b.array=a;b.view=new DataView(b.array);b.offset=0;b.length=a.byteLength;return b};c.prototype.LE=function(a){this.littleEndian="undefined"!==typeof a?!!a:!0;return this};c.prototype.BE=function(a){this.littleEndian=
null}catch(p){}c.VERSION="2.0.2";c.DEFAULT_CAPACITY=16;c.LITTLE_ENDIAN=!0;c.BIG_ENDIAN=!1;c.Long=k||null;c.allocate=function(a,b){return new c(a,b)};c.wrap=function(a,b,d){"boolean"===typeof b&&(d=b,b="utf8");if("string"===typeof a)switch(b){case "hex":return c.decodeHex(a,d);case "base64":return c.decode64(a,d);default:return(new c(c.DEFAULT_CAPACITY,d)).writeUTF8String(a).flip()}if(n&&n.isBuffer(a)){b=(new Uint8Array(a)).buffer;if(b===a){b=new ArrayBuffer(a.length);for(var e=new Uint8Array(b),f=
0,g=a.length;f<g;++f)e[f]=a[f]}a=b}if(null===a||"object"!==typeof a)throw Error("Cannot wrap null or non-object");if(a instanceof c)return a.clone();a.array?a=a.array:a.buffer&&(a=a.buffer);if(!(a instanceof ArrayBuffer))throw Error("Cannot wrap buffer of type "+typeof a+", "+a.constructor.name);b=new c(0,d,!0);b.array=a;b.view=new DataView(b.array);b.offset=0;b.length=a.byteLength;return b};c.prototype.LE=function(a){this.littleEndian="undefined"!==typeof a?!!a:!0;return this};c.prototype.BE=function(a){this.littleEndian=
"undefined"!==typeof a?!a:!1;return this};c.prototype.resize=function(a){if(1>a)return!1;null==this.array&&(this.array=new ArrayBuffer(a),this.view=new DataView(this.array));if(this.array.byteLength<a){var b=new Uint8Array(this.array);a=new ArrayBuffer(a);(new Uint8Array(a)).set(b);this.array=a;this.view=new DataView(a)}return this};c.prototype.slice=function(a,b){if(null==this.array)throw Error(this+" cannot be sliced: Already destroyed");"undefined"===typeof a&&(a=this.offset);"undefined"===typeof b&&

@@ -50,6 +50,6 @@ (b=this.length);if(b<=a){var d=b;b=a;a=d}if(0>a||a>this.array.byteLength||1>b||b>this.array.byteLength)throw Error(this+" cannot be sliced: Index out of bounds (0-"+this.array.byteLength+" -> "+a+"-"+b+")");d=this.clone();d.offset=a;d.length=b;return d};c.prototype.ensureCapacity=function(a){return null==this.array?this.resize(a):this.array.byteLength<a?this.resize(2*this.array.byteLength>=a?2*this.array.byteLength:a):this};c.prototype.flip=function(){this.length=null==this.array?0:this.offset;this.offset=

b=0==this.offset&&0==this.length?b+"|":0==this.length?b+">":0==this.offset?b+"<":b+" ",g=0,k=this.array.byteLength;g<k;g++){if(0<g&&0==g%a){for(;b.length<3*a+1;)b+=" ";c.push(b);b=" "}e=f.getUint8(g).toString(16).toUpperCase();2>e.length&&(e="0"+e);b+=e;b=g+1==this.offset&&g+1==this.length?b+"|":g+1==this.offset?b+"<":g+1==this.length?b+">":b+" "}" "!=b&&c.push(b);g=0;for(k=c.length;g<k;g++)for(;c[g].length<3*a+1;)c[g]+=" ";for(var h=0,b="",g=0,k=this.array.byteLength;g<k;g++)0<g&&0==g%a&&(c[h]+=
" "+b,b="",h++),e=f.getUint8(g),b+=32<e&&127>e?String.fromCharCode(e):".";""!=b&&(c[h]+=" "+b);return c.join("\n")};c.prototype.printDebug=function(a){"function"!==typeof a&&(a=console.log);a((null!=this.array?"ByteBuffer(offset="+this.offset+",markedOffset="+this.markedOffset+",length="+this.length+",capacity="+this.array.byteLength+")":"ByteBuffer(DESTROYED)")+"\n-------------------------------------------------------------------\n"+this.toColumns()+"\n")};c.prototype.toHex=function(a){var b="",
c=this.view,e,f;if(a){if(null==this.array)return"DESTROYED";b=0==this.offset&&0==this.length?b+"|":0==this.length?b+">":0==this.offset?b+"<":b+" ";e=0;for(f=this.array.byteLength;e<f;e++)a=c.getUint8(e).toString(16).toUpperCase(),2>a.length&&(a="0"+a),b+=a,b=e+1===this.offset&&e+1===this.length?b+"|":e+1==this.offset?b+"<":e+1==this.length?b+">":b+" "}else{if(null==this.array)return"";e=this.offset;for(f=this.length;e<f;e++)a=c.getUint8(e).toString(16).toUpperCase(),2>a.length&&(a="0"+a),b+=a}return b};
" "+b,b="",h++),e=f.getUint8(g),b+=32<e&&127>e?String.fromCharCode(e):".";""!=b&&(c[h]+=" "+b);return c.join("\n")};c.prototype.printDebug=function(a){"function"!==typeof a&&(a=console.log.bind(console));a((null!=this.array?"ByteBuffer(offset="+this.offset+",markedOffset="+this.markedOffset+",length="+this.length+",capacity="+this.array.byteLength+")":"ByteBuffer(DESTROYED)")+"\n-------------------------------------------------------------------\n"+this.toColumns()+"\n")};c.prototype.toHex=function(a){var b=
"",c=this.view,e,f;if(a){if(null==this.array)return"DESTROYED";b=0==this.offset&&0==this.length?b+"|":0==this.length?b+">":0==this.offset?b+"<":b+" ";e=0;for(f=this.array.byteLength;e<f;e++)a=c.getUint8(e).toString(16).toUpperCase(),2>a.length&&(a="0"+a),b+=a,b=e+1===this.offset&&e+1===this.length?b+"|":e+1==this.offset?b+"<":e+1==this.length?b+">":b+" "}else{if(null==this.array)return"";e=this.offset;for(f=this.length;e<f;e++)a=c.getUint8(e).toString(16).toUpperCase(),2>a.length&&(a="0"+a),b+=a}return b};
c.prototype.toBase64=function(){return null==this.array||this.offset>=this.length?"":c.encode64(this)};c.prototype.toUTF8=function(){return null==this.array||this.offset>=this.length?"":this.readUTF8StringBytes(this.length-this.offset,this.offset).string};c.prototype.toString=function(a){switch(a||""){case "utf8":return this.toUTF8();case "base64":return this.toBase64();case "hex":return this.toHex();case "debug":return this.toHex(!0);default:return null===this.array?"ByteBuffer(DESTROYED)":"ByteBuffer(offset="+
this.offset+",markedOffset="+this.markedOffset+",length="+this.length+",capacity="+this.array.byteLength+")"}};c.prototype.toArrayBuffer=function(a){if(null===this.array)return null;var b=this.clone();b.offset>b.length&&b.flip();var c=!1;if(0<b.offset||b.length<b.array.byteLength)b.compact(),c=!0;return a&&!c?b.copy().array:b.array};n&&(c.prototype.toBuffer=function(){if(null===this.array)return null;var a=this.offset,b=this.length;if(a>b)var c=a,a=b,b=c;return new n((new Uint8Array(this.array)).subarray(a,
b))});return c}"undefined"!==typeof module&&module.exports?module.exports=p(require("long")):"undefined"!==typeof define&&define.amd?define("ByteBuffer",["Math/Long"],function(k){return p(k)}):(m.dcodeIO||(m.dcodeIO={}),m.dcodeIO.ByteBuffer=p(m.dcodeIO.Long))})(this);
{
"name": "bytebuffer",
"version": "2.0.1",
"version": "2.0.2",
"author": "Daniel Wirtz <dcode@dcode.io>",

@@ -5,0 +5,0 @@ "description": "A full-featured ByteBuffer implementation using typed arrays.",

@@ -22,3 +22,3 @@ ![ByteBuffer.js - A full-featured ByteBuffer implementation in JavaScript](https://raw.github.com/dcodeIO/ByteBuffer.js/master/ByteBuffer.png)

* Chaining of all operations that do not return a specific value
* Slicing, appending, prepending, flip, reset, etc.
* Slicing, appending, prepending, reversing, flip, mark, reset, etc.

@@ -25,0 +25,0 @@ And much more...

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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