UNPKG

ghost-image-store

Version:

Ghost storage adapter that automatically creates a webp version of your uploaded images

22 lines (17 loc) 427 B
const path = require('path'); const fs = require('fs-extra'); function exists(fileName, targetDir) { const filePath = path.join(targetDir || this.storagePath, fileName); return fs.stat(filePath) .then(() => { return true; }) .catch(() => { return false; }); } module.exports = function (Store) { Object.assign(Store.prototype, { exists }); };