You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Justine Kate Catid Miras 5ef3abc3c3 this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
..
.travis.yml this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
LICENSE this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
README.md this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
index.js this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
package.json this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago
test.js this is from the organization of my bootcamp repo which is mine that i did not notice i was not pushing it to my main repo, thats why i added this here and took me long cause i have no idea how to do this thanks to my curiosity i was able to identify or solve this problem. 12 months ago

README.md

memory-pager

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

travis

npm install memory-pager

Usage

var pager = require('paged-memory')

var pages = pager(1024) // use 1kb per page

var page = pages.get(10) // get page #10

console.log(page.offset) // 10240
console.log(page.buffer) // a blank 1kb buffer

API

var pages = pager(pageSize)

Create a new pager. pageSize defaults to 1024.

var page = pages.get(pageNumber, [noAllocate])

Get a page. The page will be allocated at first access.

Optionally you can set the noAllocate flag which will make the method return undefined if no page has been allocated already

A page looks like this

{
  offset: byteOffset,
  buffer: bufferWithPageSize
}

pages.set(pageNumber, buffer)

Explicitly set the buffer for a page.

pages.updated(page)

Mark a page as updated.

pages.lastUpdate()

Get the last page that was updated.

var buf = pages.toBuffer()

Concat all pages allocated pages into a single buffer

License

MIT