Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several instances of node-persist #154

Open
Go00oglin opened this issue Oct 21, 2024 · 0 comments
Open

Several instances of node-persist #154

Go00oglin opened this issue Oct 21, 2024 · 0 comments

Comments

@Go00oglin
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant