mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-21 21:36:26 -08:00
fixes
This commit is contained in:
parent
f98f90e58a
commit
f9480d543b
|
@ -34,7 +34,7 @@
|
|||
download
|
||||
</button>
|
||||
|
||||
<div style="min-height:20px" />
|
||||
<div style="min-height:15px" />
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -170,6 +170,9 @@ app.get("/download/:fileId",(req,res) => {
|
|||
let fgRQH = async (req:express.Request,res:express.Response) => {
|
||||
files.readFileStream(req.params.fileId).then(f => {
|
||||
res.setHeader("Content-Type",f.contentType)
|
||||
if (f.byteSize) {
|
||||
res.setHeader("Content-Length",f.byteSize)
|
||||
}
|
||||
res.status(200)
|
||||
f.dataStream.pipe(res)
|
||||
}).catch((err) => {
|
||||
|
|
|
@ -215,7 +215,7 @@ export default class Files {
|
|||
|
||||
// todo: move read code here
|
||||
|
||||
readFileStream(uploadId: string):Promise<{dataStream:Readable,contentType:string}> {
|
||||
readFileStream(uploadId: string):Promise<{dataStream:Readable,contentType:string,byteSize?:number}> {
|
||||
return new Promise(async (resolve,reject) => {
|
||||
if (!this.uploadChannel) {
|
||||
reject({status:503,message:"server is not ready - please try again later"})
|
||||
|
@ -231,7 +231,8 @@ export default class Files {
|
|||
|
||||
resolve({
|
||||
contentType: file.mime,
|
||||
dataStream: dataStream
|
||||
dataStream: dataStream,
|
||||
byteSize: file.sizeInBytes
|
||||
})
|
||||
|
||||
for (let i = 0; i < file.messageids.length; i++) {
|
||||
|
|
Loading…
Reference in a new issue