Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public init(): void {
log.verbose('FaceCache', 'init()')
if (!fs.existsSync(this.workdir)) {
throw new Error(`directory not exist: ${this.workdir}`)
}
if (!this.store) {
const storeName = 'face-cache.store'
this.store = new FlashStore(
path.join(this.workdir, storeName),
)
}
if (!this.embeddingStore) {
const storeName = 'face-cache-embedding.store'
this.embeddingStore = new FlashStore(
path.join(this.workdir, storeName),
)
}
if (!this.imagedir) {
const dirName = 'imagedir'
this.imagedir = path.join(this.workdir, dirName)
if (!fs.existsSync(this.imagedir)) {
fs.mkdirSync(this.imagedir)
}
}
}
public init(): void {
log.verbose('FaceCache', 'init()')
if (!fs.existsSync(this.workdir)) {
throw new Error(`directory not exist: ${this.workdir}`)
}
if (!this.store) {
const storeName = 'face-cache.store'
this.store = new FlashStore(
path.join(this.workdir, storeName),
)
}
if (!this.embeddingStore) {
const storeName = 'face-cache-embedding.store'
this.embeddingStore = new FlashStore(
path.join(this.workdir, storeName),
)
}
if (!this.imagedir) {
const dirName = 'imagedir'
this.imagedir = path.join(this.workdir, dirName)
if (!fs.existsSync(this.imagedir)) {
fs.mkdirSync(this.imagedir)
}