Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mafintosh/changes-feed
Basic changes-feed implementation that runs on top of leveldb
https://github.com/mafintosh/changes-feed
Last synced: 25 days ago
JSON representation
Basic changes-feed implementation that runs on top of leveldb
- Host: GitHub
- URL: https://github.com/mafintosh/changes-feed
- Owner: mafintosh
- License: mit
- Created: 2015-01-15T22:31:36.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-08T15:48:46.000Z (almost 9 years ago)
- Last Synced: 2024-10-29T23:18:07.047Z (3 months ago)
- Language: JavaScript
- Size: 9.77 KB
- Stars: 28
- Watchers: 4
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - `levelup`
README
# changes-feed
Basic changes-feed implementation that runs on top of leveldb
```
npm install changes-feed
```[![build status](http://img.shields.io/travis/mafintosh/changes-feed.svg?style=flat)](http://travis-ci.org/mafintosh/changes-feed)
## Usage
``` js
var changes = require('changes-feed')
var feed = changes(db) // db is a levelupfeed.createReadStream({live:true})
.on('data', function(data) {
console.log('someone appended:', data)
})feed.append('hello')
```## API
#### `feed.append(value)`
Append a new value to the changes feed. The value should be a string or buffer
#### `stream = feed.createReadStream([options])`
Stream out entries from the log. Per default this will stream out all entries.
Options include:``` js
{
live: true, // keep the stream open,
since: number // only get changes >number
}
```A stream data object looks like this
``` js
{
change: number, // incrementing change number
value: value // the value appended
}
```## License
MIT