diff --git a/src/core/Image.js b/src/core/Image.js index 3bed05f1..2b5e8a98 100644 --- a/src/core/Image.js +++ b/src/core/Image.js @@ -14,6 +14,14 @@ class Image { return new Image({...data, artifacts}) } + static async findByFile(file) { + const data = await findOne(store(), {file}) + if (!data) return null + + const artifacts = data.data + return new Image({...data, artifacts}) + } + constructor({hash, file, artifacts}) { this.hash = hash this.file = file