diff --git a/.travis.yml b/.travis.yml index 2da9255..495cad9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: node_js node_js: - - 10 - - 9 - - 8 - 6 + - 8 + - 9 + - 10 diff --git a/LICENSE.md b/LICENSE.md index dd2ded0..29538ec 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,10 +1,8 @@ -The MIT License (MIT) -===================== +# The MIT License (MIT) -Copyright (c) 2012-2017 LevelUP contributors ---------------------------------------- +## Copyright (c) 2012-present `level-iterator-stream` contributors -*LevelUP contributors listed at * +*`level-iterator-stream` contributors listed at * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/README.md b/README.md index 0917fb3..721d0d7 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,26 @@ - # level-iterator-stream -LevelDB Logo - > Turn a leveldown iterator into a readable stream -[![Build Status](https://travis-ci.org/Level/iterator-stream.png)](https://travis-ci.org/Level/iterator-stream) [![Greenkeeper badge](https://badges.greenkeeper.io/Level/iterator-stream.svg)](https://greenkeeper.io/) +[![level badge][level-badge]](https://github.com/level/awesome) +[![npm](https://img.shields.io/npm/v/level-iterator-stream.svg)](https://www.npmjs.com/package/level-iterator-stream) +![Node version](https://img.shields.io/node/v/level-iterator-stream.svg) +[![Build Status](https://img.shields.io/travis/Level/iterator-stream.svg)](https://travis-ci.org/Level/iterator-stream) +[![dependencies](https://david-dm.org/Level/iterator-stream.svg)](https://david-dm.org/level/iterator-stream) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) +[![npm](https://img.shields.io/npm/dm/level-iterator-stream.svg)](https://www.npmjs.com/package/level-iterator-stream) -## Example +## Usage ```js -const iteratorStream = require('level-iterator-stream') -const leveldown = require('leveldown') +var iteratorStream = require('level-iterator-stream') +var leveldown = require('leveldown') -const db = leveldown(__dirname + '/db') +var db = leveldown(__dirname + '/db') db.open(function (err) { if (err) throw err - const stream = iteratorStream(db.iterator()) + var stream = iteratorStream(db.iterator()) stream.on('data', function (kv) { console.log('%s -> %s', kv.key, kv.value) }) @@ -32,26 +35,20 @@ $ npm install level-iterator-stream ## API -### iteratorStream(iterator[, options]) - - Create a readable stream from `iterator`. `options` are passed down to the - `require('readable-stream').Readable` constructor, with `objectMode` forced - to `true`. +### `stream = iteratorStream(iterator[, options])` - Set `options.keys` or `options.values` to `false` to only get values / keys. Otherwise receive `{ key, value }` objects. +Create a readable stream from `iterator`. `options` are passed down to the `require('readable-stream').Readable` constructor, with `objectMode` forced to `true`. - When the stream ends, the `iterator` will be closed and afterwards a - `"close"` event emitted. +Set `options.keys` or `options.values` to `false` to only get values / keys. Otherwise receive `{ key, value }` objects. - `.destroy()` will force close the underlying iterator. +When the stream ends, the `iterator` will be closed and afterwards a `"close"` event emitted. -## Publishers +`.destroy()` will force close the underlying iterator. -* [@juliangruber](https://github.com/juliangruber) -* [@ralphtheninja](https://github.com/ralphtheninja) +## License -## License & copyright +Copyright © 2012-present `level-iterator-stream` contributors. -Copyright (c) 2012-2017 LevelUP contributors. +`level-iterator-stream` is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included `LICENSE.md` file for more details. -LevelUP is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. +[level-badge]: http://leveldb.org/img/badge.svg diff --git a/package.json b/package.json index 5281c1e..d2c158a 100644 --- a/package.json +++ b/package.json @@ -17,5 +17,8 @@ "tape": "^4.4.0", "through2": "^2.0.0" }, + "engines": { + "node": ">=6" + }, "license": "MIT" }