-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes ts warnings due too root dir.
- Loading branch information
Showing
5 changed files
with
27 additions
and
20 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {ZipHandler} from "../../ZipHandler"; | ||
import SQLHandler from "../../SQLHandler"; | ||
|
||
export async function createDatabaseFrom(zip: ZipHandler) { | ||
const collectionFilename = "collection.anki21"; | ||
const collection = zip.files.find((f) => f.name === collectionFilename); | ||
const contents = collection!.contents; | ||
const db = new SQLHandler(); | ||
await db.load(contents); | ||
return db; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import path from "path"; | ||
import fs from "fs"; | ||
import {ZipHandler} from "../../ZipHandler"; | ||
|
||
export async function getInputFileAsZipHandler(apkg: string) { | ||
const filePath = path.join(__dirname, `artifacts/${apkg}`); | ||
const data = fs.readFileSync(filePath); | ||
const zip = new ZipHandler(); | ||
await zip.build(data); | ||
return zip; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters