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

buffers

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buffers - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

26

index.js

@@ -157,1 +157,27 @@ module.exports = Buffers;

};
Buffers.prototype.get = function get (i) {
if (i < 0 || i >= this.length) throw new Error('oob');
var l = i, bi = 0, bu = null;
for (;;) {
bu = this.buffers[bi++];
if (l < bu.length) {
return bu.get(l);
} else {
l -= bu.length;
}
}
};
Buffers.prototype.set = function set (i, b) {
if (i < 0 || i >= this.length) throw new Error('oob');
var l = i, bi = 0, bu = null;
for (;;) {
bu = this.buffers[bi++];
if (l < bu.length) {
return bu.set(l, b);
} else {
l -= bu.length;
}
}
};

2

package.json
{
"name" : "buffers",
"description" : "Treat a collection of Buffers as a single contiguous partially mutable Buffer.",
"version" : "0.0.2",
"version" : "0.0.3",
"repository" : "http://github.com/substack/node-buffers.git",

@@ -6,0 +6,0 @@ "author" : "James Halliday <mail@substack.net> (http://substack.net)",

var assert = require('assert');
var Buffers = require('buffers');
var Buffers = require('../');

@@ -155,1 +155,30 @@ function create (xs, split) {

};
exports.get = function () {
var bufs = Buffers();
bufs.unshift(new Buffer([6,7,8,9]));
bufs.unshift(new Buffer([4,5]));
bufs.unshift(new Buffer([1,2,3]));
bufs.unshift(new Buffer([0]));
assert.eql( bufs.get(0), 0 );
assert.eql( bufs.get(1), 1 );
assert.eql( bufs.get(2), 2 );
assert.eql( bufs.get(3), 3 );
assert.eql( bufs.get(4), 4 );
assert.eql( bufs.get(5), 5 );
assert.eql( bufs.get(6), 6 );
assert.eql( bufs.get(7), 7 );
assert.eql( bufs.get(8), 8 );
assert.eql( bufs.get(9), 9 );
};
exports.set = function () {
var bufs = Buffers();
bufs.push(new Buffer("Hel"));
bufs.push(new Buffer("lo"));
bufs.push(new Buffer("!"));
bufs.set(0, 'h'.charCodeAt(0) );
bufs.set(3, 'L'.charCodeAt(0) );
bufs.set(5, '.'.charCodeAt(0) );
assert.eql( bufs.slice(0).toString(), 'helLo.' );
};

Sorry, the diff of this file is not supported yet

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