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

atomicbuffers

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

atomicbuffers - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

example/index.js

3

package.json
{
"name": "atomicbuffers",
"version": "1.0.0",
"version": "1.0.1",
"description": "Atomic `readInt32()`, `writeInt32()`, `readUInt32()` and `writeUInt32()` for node.js buffers.",

@@ -23,2 +23,3 @@ "main": "lib/atomicbuffers.js",

"devDependencies": {
"mmap.js": "^1.0.1",
"mocha": "^1.21.5"

@@ -25,0 +26,0 @@ },

@@ -35,2 +35,7 @@ "use strict";

});
it('should throw on oob', function() {
assert.throws(function() {
atomic.writeInt32(buf, 0, buf.length);
});
});
});

@@ -60,2 +65,7 @@

});
it('should throw on oob', function() {
assert.throws(function() {
atomic.writeUInt32(buf, 0, buf.length);
});
});
});

@@ -85,2 +95,8 @@

});
it('should throw on oob', function() {
assert.throws(function() {
atomic.readInt32(buf, buf.length);
});
});
});

@@ -122,6 +138,12 @@

});
it('should throw on oob', function() {
assert.throws(function() {
atomic.readUInt32(buf, buf.length);
});
});
});
describe('Benchmarks', function () {
let buf = new Buffer(16).fill(0);
var buf = new Buffer(16).fill(0);
buf.writeInt32LE(123, 0);

@@ -131,6 +153,6 @@ buf.writeUInt32LE(456, 4);

benchmark("readInt32", 1000000, {
Native () {
Native: function () {
return atomic.readInt32(buf, 0);
},
Node () {
Node: function () {
return buf.readInt32LE(0);

@@ -141,6 +163,6 @@ }

benchmark("readUInt32", 1000000, {
Native () {
Native: function () {
return atomic.readUInt32(buf, 4);
},
Node () {
Node: function () {
return buf.readUInt32LE(4);

@@ -151,6 +173,6 @@ }

benchmark("writeInt32", 1000000, {
Native () {
Native: function () {
return atomic.writeInt32(buf, 4096, 0);
},
Node () {
Node: function () {
return buf.writeInt32LE(4096, 0);

@@ -161,6 +183,6 @@ }

benchmark("writeUInt32", 1000000, {
Native () {
Native: function () {
return atomic.writeUInt32(buf, 4096, 0);
},
Node () {
Node: function () {
return buf.writeUInt32LE(4096, 0);

@@ -167,0 +189,0 @@ }

Sorry, the diff of this file is not supported yet

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