Ensure data dir on each upload

pull/4/head
trivernis 5 years ago
parent 54646e6b73
commit c48fcc3d89

@ -193,6 +193,7 @@ export class UploadRoute extends Route {
private async processAndStoreImage(data: Buffer, width = 512, height = 512, private async processAndStoreImage(data: Buffer, width = 512, height = 512,
fit: ImageFit = "cover"): Promise<string> { fit: ImageFit = "cover"): Promise<string> {
const fileBasename = UploadRoute.getFileName() + "." + config.get("api.imageFormat"); const fileBasename = UploadRoute.getFileName() + "." + config.get("api.imageFormat");
await fsx.ensureDir(this.dataDir);
const filePath = path.join(this.dataDir, fileBasename); const filePath = path.join(this.dataDir, fileBasename);
let image = await sharp(data) let image = await sharp(data)
.resize(width, height, { .resize(width, height, {

Loading…
Cancel
Save