node-persist
node-persist copied to clipboard
Several instances of node-persist
Hi I was going to use the node-persist in different parts of single node.js application, assuming different folders for persisting. But it looks like the last Init becomes the single Init.
For example:
const storage1 = require('node-persist');
const storage2 = require('node-persist');
async function test() {
await storage1.init({dir: "./p1" });
await storage2.init({dir: "./p2" });
storage1.setItem("1", "First");
storage2.setItem("2", "Second");
}
test();
In this case, the p1 and p2 folder will be created, but both files are created in the p2 folder.