
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
hapi-level
Advanced tools
A simple LevelDB plugin for Hapi.
Note: Sublevel has been updated to v6 in version 3.0.0
which has breaking changes which will corrupt a pre version 6 database, read about the sublevel breaking changes before updating, there is a migration tool to help with the upgrade.
Register plugin as follows, an optional options object can be passed in to specify data storage location 'path', and the config object supports all LevelUp options:
const Hapi = require('hapi');
var server = Hapi.createServer();
server.connection();
server.register([
{
register: require('hapi-level'),
options: {
path: './data', // ./data by default
config: {
valueEncoding: 'json' // utf8 by default as with LevelUP
}
}
}
], (err) => {
if (err) {
throw err;
}
server.start((err) => {
if (err) {
throw err;
}
console.log('Server started at: ' + server.info.uri);
})
};
To use plugin:
// New in 5.0: Make sure either `server.initialize()` or `server.start()` has been called
// to have access to the db reference
// Accessing level object
const db = request.server.plugins['hapi-level'].db; // access from a request object
// or
const db = plugin.plugins['hapi-level'].db; // access in a hapi plugin
// Usage works just like LevelDB would
db.put('name', 'Level', (err) => {
if (err) {
return console.log('Ooops!', err); // some kind of I/O error
}
db.get('two', (err, value) => {
if (err) {
return console.log('Ooops!', err); // likely the key was not found
}
console.log('name=' + value);
});
});
});
// Sublevel is also available to use for sectioning of data, similar to SQL tables
users.put('two', {id: 2, name: 'Level'}, (err) => {
if (err) {
return console.log('Ooops!', err); // some kind of I/O error
}
users.get('two', (err, value) => {
if (err) {
return console.log('Ooops!', err); // likely the key was not found
}
console.log(value); // would output {id: 2, name: 'Level'}
});
});
});
FAQs
LevelDB service provider for Hapi
The npm package hapi-level receives a total of 43 weekly downloads. As such, hapi-level popularity was classified as not popular.
We found that hapi-level demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.