Skip to main content
Deno 2 is finally here 🎉️
Learn more
class DatabaseImporter
implements OnLoad
import { DatabaseImporter } from "https://deno.land/x/sptaki@1.2.0/utils/DatabaseImporter.d.ts";

Constructors

new
DatabaseImporter(
logger: ILogger,
vfs: VFS,
jsonUtil: JsonUtil,
localisationService: LocalisationService,
databaseServer: DatabaseServer,
imageRouter: ImageRouter,
encodingUtil: EncodingUtil,
hashUtil: HashUtil,
importerUtil: ImporterUtil,
configServer: ConfigServer,
)

Properties

private
filepath
private
hashedFile
private
valid
protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
encodingUtil: EncodingUtil
protected
hashUtil: HashUtil
protected
httpConfig: IHttpConfig
protected
imageRouter: ImageRouter
protected
importerUtil: ImporterUtil
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
vfs: VFS

Methods

protected
getImagePathOverride(imagePath: string): string

Check for a path override in the http json config file

protected
hydrateDatabase(filepath: string): Promise<void>

Read all json files in database folder and map into a json object

protected
onReadValidate(fileWithPath: string, data: string): void
protected
validateFile(filePathAndName: string, fileData: any): boolean
getRoute(): string
getSptDataPath(): string

Get path to aki data

loadImages(
filepath: string,
directories: string[],
routes: string[],
): void

Find and map files with image router inside a designated path

onLoad(): Promise<void>