Skip to content
An optimized live-copy from one levelup instance to another.
JavaScript
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
examples
test
.gitignore
.npmignore
LICENSE
README.md
index.js
package.json

README.md

level-rawcopy

NPM

david-dm david-dm

Optimized live copying of levelup instances.

Uses level-bufferstreams internally to optimize copy operations.

If you are using level-hyper it will attempt to use the LiveCopy feature.

NOTES: This is still experimental and has some issues on some LevelDOWN layers/versions. I am working those out.

var level = require("level")
var source = level("./your_source_db")
var target = level("./your_target_db")

var rawcopy = require("level-rawcopy")

rawcopy(source, target, function () {
  console.log("DONE!")
})

STATS

Comparing copies on a 180 megabyte level-hyper db:

db1.readStream().pipe(db2.writeStream())

{ rss: 3204366336, heapTotal: 1488523264, heapUsed: 1346318856 }
slowLoad: 382969ms

rawcopy(db1, db2)

{ rss: 656027648, heapTotal: 59279872, heapUsed: 28893008 }
fastLoad: 369023ms

Right now the speed is appears mostly bottle-necked by the iterator, see https://github.com/rvagg/node-leveldown/pull/34

API

rawcopy(source, target, options, callback)

Copies data from a LevelUP instance source into target. The target can be another LevelUP instance, or a path to a desired location. If a path is provided, you must also provide a LevelDOWN factory to use in options (same as when creating a levelup instance). Options also will respect level-bufferstreams options for the read and write ends.

LICENSE

MIT

Something went wrong with that request. Please try again.