Socket
Socket
Sign inDemoInstall

memory-pager

Package Overview
Dependencies
0
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 1.2.0

20

index.js
module.exports = Pager
function Pager (pageSize) {
if (!(this instanceof Pager)) return new Pager(pageSize)
function Pager (pageSize, opts) {
if (!(this instanceof Pager)) return new Pager(pageSize, opts)

@@ -10,2 +10,3 @@ this.length = 0

this.pageSize = pageSize || 1024
this.deduplicate = opts ? opts.deduplicate : null
}

@@ -39,2 +40,6 @@

if (page && page.buffer === this.deduplicate && this.deduplicate && !noAllocate) {
page.buffer = copy(page.buffer)
}
return page

@@ -52,2 +57,7 @@ }

if (this.deduplicate && buf.equals && buf.equals(this.deduplicate)) {
buf = this.deduplicate
return
}
var page = this.pages[i]

@@ -95,2 +105,8 @@ var b = truncate(buf, this.pageSize)

function copy (buf) {
var cpy = Buffer.allocUnsafe ? Buffer.allocUnsafe(buf.length) : new Buffer(buf.length)
buf.copy(cpy)
return cpy
}
function Page (i, buf) {

@@ -97,0 +113,0 @@ this.offset = i * buf.length

2

package.json
{
"name": "memory-pager",
"version": "1.1.0",
"version": "1.2.0",
"description": "Access memory using small fixed sized buffers",

@@ -5,0 +5,0 @@ "main": "index.js",

# memory-pager
Access memory using small fixed sized buffers instead of allocating a huge buffer.
Useful if you are implmenting sparse data structures (such as large bitfield).
Useful if you are implementing sparse data structures (such as large bitfield).

@@ -6,0 +6,0 @@ ![travis](https://travis-ci.org/mafintosh/memory-pager.svg?branch=master)

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