memory-pager
Advanced tools
Comparing version 1.0.0 to 1.0.1
12
index.js
@@ -49,4 +49,4 @@ module.exports = Pager | ||
if (page) page.buffer = buf | ||
else page = this.pages[i] = new Page(i, buf) | ||
if (page) page.buffer = truncate(buf, this.pageSize) | ||
else page = this.pages[i] = new Page(i, truncate(buf, this.pageSize)) | ||
} | ||
@@ -74,2 +74,10 @@ | ||
function truncate (buf, len) { | ||
if (buf.length === len) return len | ||
if (buf.length > len) return buf.slice(0, len) | ||
var cpy = alloc(len) | ||
buf.copy(cpy) | ||
return cpy | ||
} | ||
function alloc (size) { | ||
@@ -76,0 +84,0 @@ if (Buffer.alloc) return Buffer.alloc(size) |
{ | ||
"name": "memory-pager", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Access memory using small fixed sized buffers", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6492
127