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

smart-buffer

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smart-buffer - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

typings/index.ds.ts

15

lib/smart-buffer.js

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

/**
* Writes a null terminated Buffer to the underlying buffer.
* @param value {Buffer} The buffer to write.
* @param offset {Number} The offset to write the Buffer to.
* @returns {*}
*/
SmartBuffer.prototype.writeBufferNT = function (value, offset) {
var len = value.length;
this._ensureWritable(len, offset);
value.copy(this.buff, offset || this._writeOffset);
this.buff[this._writeOffset + len] = 0x00;
this._writeOffset += len + 1;
return this;
};
/**

@@ -282,0 +297,0 @@ * Resets the Endless Buffer.

3

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

@@ -37,2 +37,3 @@ "main": "lib/smart-buffer.js",

},
"typings": "typings/index",
"dependencies": {},

@@ -39,0 +40,0 @@ "scripts": {

@@ -246,3 +246,10 @@ smart-buffer [![Build Status](https://travis-ci.org/JoshGlazebrook/smart-buffer.svg?branch=master)](https://travis-ci.org/JoshGlazebrook/smart-buffer) [![Coverage Status](https://coveralls.io/repos/github/JoshGlazebrook/smart-buffer/badge.svg?branch=master)](https://coveralls.io/github/JoshGlazebrook/smart-buffer?branch=master)

### SmartBuffer.writeBufferNT( value, [offset] )
> `Buffer` **Buffer value to write**
> `Number` **The position to insert this Buffer's content at**
returns this
## Utility Functions

@@ -249,0 +256,0 @@

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

});
});
describe('Null Terminated Buffer Writing', function () {
var buff = new SmartBuffer();
buff.writeBufferNT(new Buffer([0x01, 0x02, 0x03, 0x04]));
var read1 = buff.readBufferNT();
it('Should read the correct null terminated buffer data.', function () {
assert.equal(read1.length, 4);
});
})

@@ -232,0 +244,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