mirror of
https://github.com/cupcakearmy/morphus.git
synced 2024-12-21 23:56:27 +00:00
fix bug on local
This commit is contained in:
parent
432d9dd140
commit
6f3f9dd9d9
@ -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<NodeJS.ReadableStream> {
|
||||
async readStream(path: string): Promise<NodeJS.ReadableStream> {
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user