Socket
Socket
Sign inDemoInstall

smart-buffer

Package Overview
Dependencies
0
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

3

lib/smart-buffer.js

@@ -156,3 +156,3 @@ var SmartBuffer = (function () {

SmartBuffer.prototype.readStringNT = function (encoding) {
var nullpos = this.length - 1;
var nullpos = this.length;
for (var i = this._readOffset; i < this.length; i++) {

@@ -164,2 +164,3 @@ if (this.buff[i] == 0x00) {

}
var result = this.buff.slice(this._readOffset, nullpos);

@@ -166,0 +167,0 @@ this._readOffset = nullpos + 1;

{
"name": "smart-buffer",
"version": "1.0.0",
"version": "1.0.1",
"description": "A smarter Buffer that keeps track of its own read and write positions while growing endlessly.",

@@ -5,0 +5,0 @@ "main": "lib/smart-buffer.js",

@@ -147,2 +147,25 @@ var SmartBuffer = require('../lib/smart-buffer.js');

describe("Null/non-null terminating strings", function () {
var reader = new SmartBuffer();
reader.writeString("hello\0test\0bleh");
it("should equal hello", function() {
assert.strictEqual(reader.readStringNT(), "hello");
});
it("should equal: test", function() {
assert.strictEqual(reader.readString(4), "test");
});
it("should have a length of zero", function() {
assert.strictEqual(reader.readStringNT().length, 0);
});
it("should equal: bleh", function () {
assert.strictEqual(reader.readStringNT(), "bleh");
});
});
describe("Buffer Values", function () {

@@ -149,0 +172,0 @@ var buff = new Buffer([0x01, 0x02, 0x04, 0x08, 0x16, 0x32, 0x64]);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚑️ by Socket Inc