Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/random-access-storage/abstract-random-access

Base class for random access stores
https://github.com/random-access-storage/abstract-random-access

Last synced: 3 months ago
JSON representation

Base class for random access stores

Awesome Lists containing this project

README

        

# DEPRECATED

Use [random-access-storage](https://github.com/random-access-storage/random-access-storage) instead.

# abstract-random-access

Base class for random access stores, such as

- [random-access-file](https://github.com/mafintosh/random-access-file)
- [random-access-memory](https://github.com/mafintosh/random-access-memory)

## Features

- ensures the store has been `.open()`ed
- verifies and defaults arguments
- provides stubs for unimplemented functions
- emits `open` and `close` events

## Example

```js
var Abstract = require('abstract-random-access')
var inherits = require('inherits')

var Store = function () {
Abstract.call(this)
}

inherits(Store, Abstract)

Store.prototype._read = function (offset, length, callback) {
process.nextTick(function () {
callback(null, Buffer('ohai'))
})
}
```

## License

MIT