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

flexbuffer

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flexbuffer - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

13

flexbuffer.js

@@ -35,12 +35,15 @@

}
var len = arg.length
if(typeof arg === "string")
var len = Buffer.byteLength(arg);
else
var len = arg.length;
if(this.tail+len >= this.length)
this.resizeBuffer(len)
if(Buffer.isBuffer(arg)){
arg.copy(this.buffer,this.tail)
}else{
if(typeof arg === "string")
this.buffer.write(arg,this.tail)
else
this.buffer.write(String(arg),this.tail)
this.buffer.write(arg,this.tail)
}

@@ -47,0 +50,0 @@ this.tail+=len

@@ -6,3 +6,3 @@ {

"description": "Buffer optimized",
"version": "0.0.1",
"version": "0.0.2",
"main" : "./flexbuffer",

@@ -9,0 +9,0 @@ "homepage": "https://github.com/mercadolibre/flexbuffer-node",

@@ -269,4 +269,19 @@ var should = require('should');

it ("test write caracateres especiales", function (done) {
var str = "\u00bd + \u00bc = \u00be";
var flexbuffer = new fbuffers.FlexBuffer();
flexbuffer.write(str);
var buffer = new Buffer(str);
flexbuffer.getBuffer().length.should.equal(buffer.length);
// console.log ("flexbuffer.getBufferReference().length: "+flexbuffer.getBufferReference().length);
// console.log ("flexbuffer.getBuffer().length: "+flexbuffer.getBuffer().length);
// console.log ("flexbuffer.getBufferReference().toString().length: "+flexbuffer.getBufferReference().toString('utf8').length);
// console.log ("flexbuffer.getBuffer().toString().length: "+flexbuffer.getBuffer().toString('ascii').length);
// console.log ("str.length: "+str.length);
// console.log ("flexbuffer.getLength: "+flexbuffer.getLength());
// console.log ("buffer.length: "+buffer.length);
// new String (flexbuffer.getBuffer(), 'utf8').should.equal(str);
done();
});
});
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