Plugins
Make sure you trust the plugin as they have access to your database. Read below on a way around this.
1. Create a file with the plugins you wish to use
module.exports = {
package_example: require("dubnium-test-pkg"),
function_example: () => { console.log("Hello, world") },
}2. Load the file
You must run the loadFromFile() method before the plugin can be used.
const { PluginManager } = require("dubnium")
PluginManager.loadFromFile('./path/to/my_plugins.js')Be sure to run this! You can check if the plugin is registered by checking PluginManager.activePlugins. If you updated Dubnium, the plugins may have been reset.
3. Use the Plugin
Allow access to all data
const { Dubnium } = require("dubnium")
const db = new Dubnium('./test_db','json')
db.usePlugin("name")Customize Plugin's access
If you do not want to give access to your data through Dubnium, you can also access the plugins property.
const { Dubnium } = require("dubnium")
const db = new Dubnium('./test_db','json')
db.plugins.name(database, record)Last updated
Was this helpful?