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

Error with .apkg files and anki3 files #2

Open
HazemE1 opened this issue Aug 28, 2024 · 0 comments
Open

Error with .apkg files and anki3 files #2

HazemE1 opened this issue Aug 28, 2024 · 0 comments

Comments

@HazemE1
Copy link

HazemE1 commented Aug 28, 2024

This is running on a nextjs server, server action, this is the code to get the error:


export async function generateDeckFromAnkiFile(formData: FormData) {
  const file = formData.get("file") as File;

  readAnkiPackage(file).then((extractedPackage) => {
    const { collection, media } = extractedPackage;

    const decks = collection.getDecks();
    for (const [deckId, deck] of Object.entries(decks)) {
      console.log(deckId, deck.getRawDeck());
      for (const [cardId, card] of Object.entries(deck.getCards())) {
        console.log(cardId, card.getRawCard());
      }
    }

    for (const [name, blob] of Object.entries(media)) {
      console.log(name, blob);
    }
  });
}

⨯ unhandledRejection: Error: Error loading SQLite database
at eval (webpack-internal:///(action-browser)/./node_modules/anki-reader/lib/src/index.js:24:15)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async readAnkiCollection (webpack-internal:///(action-browser)/./node_modules/anki-reader/lib/src/index.js:17:24)
at async eval (webpack-internal:///(action-browser)/./node_modules/anki-reader/lib/src/index.js:73:28)
at async readAnkiPackage (webpack-internal:///(action-browser)/./node_modules/anki-reader/lib/src/index.js:67:12)

@github-staff github-staff deleted a comment from ViniciusSCG Oct 1, 2024
@github-staff github-staff deleted a comment from ViniciusSCG Oct 1, 2024
@github-staff github-staff deleted a comment from ViniciusSCG Oct 1, 2024
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

4 participants
@HazemE1 and others