Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mafintosh/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.
https://github.com/mafintosh/random-access-page-files
Last synced: about 1 month ago
JSON representation
An abstract-random-access backend that writes to fixed size page files instead of a single file. Useful for sparse data.
- Host: GitHub
- URL: https://github.com/mafintosh/random-access-page-files
- Owner: mafintosh
- License: mit
- Created: 2016-10-06T20:34:58.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-10-19T18:36:17.000Z (over 8 years ago)
- Last Synced: 2024-12-13T13:02:40.865Z (about 1 month ago)
- Language: JavaScript
- Size: 3.91 KB
- Stars: 20
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-dat - random-access-page-files - backend writing to fixed size page files, useful for sparse data (Dat Core Modules / Storage)
README
# random-access-page-files
An [abstract-random-access](https://github.com/juliangruber/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](http://img.shields.io/travis/mafintosh/random-access-page-files.svg?style=flat)](http://travis-ci.org/mafintosh/random-access-page-files)
## Usage
``` js
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:
``` js
{
pageSize: 5 * 1024 * 1024, // how big are the page files?
limit: 16 // how many open files at max?
}
```## License
MIT