From 6f3f9dd9d95e9b28a08d900b213e65d8c36701ad Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sat, 5 Feb 2022 23:21:59 +0100 Subject: [PATCH] fix bug on local --- src/storage/local.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/storage/local.ts b/src/storage/local.ts index 758bf80..06e0505 100644 --- a/src/storage/local.ts +++ b/src/storage/local.ts @@ -1,6 +1,7 @@ import fs from 'fs' import { join, resolve } from 'path' import { promisify } from 'util' +import { App } from '..' import { Storage } from './' @@ -37,8 +38,9 @@ export class Local implements Storage { }) } - readStream(path: string): Promise { + async readStream(path: string): Promise { const file = join(this.root, path) + if (!(await this.exists(path))) throw new Error(`File not found: ${path}`) return new Promise((resolve, reject) => { const stream = fs.createReadStream(file) stream.on('error', reject)