Server IP : 92.205.26.207 / Your IP : 216.73.216.16 Web Server : Apache System : Linux 207.26.205.92.host.secureserver.net 4.18.0-553.60.1.el8_10.x86_64 #1 SMP Thu Jul 10 04:01:16 EDT 2025 x86_64 User : zikryat ( 1002) PHP Version : 8.3.23 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/zikryat/public_html/node_modules/memory-pager/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
# 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).  ``` npm install memory-pager ``` ## Usage ``` js 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 ``` js { 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