Skip to content

An abstract-random-access backend that writes to fixed size page files instead of a single file. Useful for sparse data.

License

Notifications You must be signed in to change notification settings

mafintosh/random-access-page-files

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-access-page-files

An abstract-random-access backend that writes to fixed size page files instead of a single file. Useful for sparse data.

npm install random-access-page-files

build status

Usage

var pages = require('random-access-page-files')

var storage = pages('a-folder', {
  pageSize: 5 * 1024 * 1024 // use 5mb pages
})

// will write use single page file < 5mb
storage.write(222852525, new Buffer('hello'), function (err) {
  if (err) throw err
  storage.read(222852525, 5, function (err, buf) {
    if (err) throw err
    console.log(buf)
  })
})

API

var storage = pages(folder, [options])

Create a new storage provider. Options include:

{
  pageSize: 5 * 1024 * 1024, // how big are the page files?
  limit: 16 // how many open files at max?
}

License

MIT

About

An abstract-random-access backend that writes to fixed size page files instead of a single file. Useful for sparse data.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published