Skip to content

Several instances of node-persist #154

Description

@Go00oglin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions