This document describes breaking changes and how to upgrade. For a complete list of changes including minor and patch releases, please refer to the changelog.
Drops support of abstract-level 1 (and its callback API) as well as Node.js < 18. Stick with level-read-stream 1 if you need to support both abstract-level 1 and 2.
If you are migrating from levelup or level <= 7 to an abstract-level database, that database will no longer have stream methods. If you previously did:
const stream = db.createReadStream(...)You must now do:
const { EntryStream } = require('level-read-stream')
const stream = new EntryStream(db, ...)Same goes for db.createKeyStream() and db.createValueStream(). If you previously did:
const keys = db.createKeyStream(...)
const values = db.createValueStream(...)You must now do:
const { KeyStream, ValueStream } = require('level-read-stream')
const keys = new KeyStream(db, ...)
const values = new ValueStream(db, ...)The arguments (... in the examples above) are the same except that EntryStream does not take keys or values options. If you previously did e.g.:
const keys = db.createReadStream({ keys: true, values: false })You must now do:
const keys = new KeyStream(db)For TypeScript users: you will also need to npm install @types/readable-stream.