Failed to run server when use level@8
mvtm-dn opened this issue · 1 comments
mvtm-dn commented
Unhandled exception during server initialization for leveldb@8.
Code:
const multileveldown = require('multileveldown')
const { Level } = require('level')
const net = require('net')
function server() {
const db = new Level('db')
const server = net.createServer(function (sock) {
sock.on('error', function () {
sock.destroy()
})
sock.pipe(multileveldown.server(db)).pipe(sock)
})
console.log('Server');
server.listen(9000);
console.log('Server started');
}
function client() {
const db = multileveldown.client()
const sock = net.connect(9000)
console.log('Client');
sock.pipe(db.connect()).pipe(sock)
console.log('Client started');
db.put('hello', 'world', function () {
db.get('hello', console.log)
})
}
server();
client();
Expected
# node ./server.js
Server
Server started
Client
Client started
null world
That is what you get
# node ./server.js
Server
Server started
Client
Client started
/home/mvtm/projects/bugs-level/node_modules/multileveldown/server.js:35
if (db.isOpen()) ready()
^
TypeError: db.isOpen is not a function
at Object.module.exports [as server] (/home/mvtm/projects/bugs-level/node_modules/multileveldown/server.js:35:10)
at Server.<anonymous> (/home/mvtm/projects/bugs-level/server.js:13:28)
at Server.emit (node:events:526:28)
at TCP.onconnection (node:net:1573:8)
vweevers commented
multileveldown
is not compatible with abstract-level
and thus level@8
. Please upgrade to many-level
. For more, see:
How do I upgrade to abstract-level?
We've put together several upgrade guides for different modules. [..] If you use a combination of the modules listed here, each must be upgraded to itsabstract-level
equivalent.
— https://github.com/Level/community#how-do-i-upgrade-to-abstract-level