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

How to duplicate Leveldb from one location to another? #15

Open
navanshu opened this issue Jun 9, 2023 · 0 comments
Open

How to duplicate Leveldb from one location to another? #15

navanshu opened this issue Jun 9, 2023 · 0 comments
Labels

Comments

@navanshu
Copy link

navanshu commented Jun 9, 2023

I want to copy all the contents of a leveldb all documents to another instance, would this code be sufficient or should I do something else

  const source = new LeveldbPersistence(path);
  const target = new LeveldbPersistence(T);
  
  const list = await source.getAllDocNames();
  
  const proms = list.map(async (d) => {
    const item = await target.getYDoc(d);
    await target.storeUpdate(d, encodeStateAsUpdate(item));
  });
  
  await Promise.all(proms);
@navanshu navanshu changed the title How to duplication Leveldb from one location to another? How to duplicate Leveldb from one location to another? Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant