added dynamic mime type
This commit is contained in:
parent
3cc9626b5f
commit
f694ab6a68
@ -3,6 +3,7 @@ import * as minio from "minio";
|
||||
import 'dotenv/config';
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import mime from "mime-types";
|
||||
|
||||
|
||||
let minioClient = new minio.Client({
|
||||
@ -28,7 +29,7 @@ app.get("/img/:bucket/:image_path(*)", async (req, res) => {
|
||||
})
|
||||
objStream.on('end', function() {
|
||||
res.header("Access-Control-Allow-Origin", "*");
|
||||
res.writeHead(200, {'Content-Type': 'image/jpeg'});
|
||||
res.writeHead(200, {'Content-Type': mime.lookup(req.params.image_path) });
|
||||
res.write(data);
|
||||
res.end();
|
||||
})
|
||||
|
||||
1
package-lock.json
generated
1
package-lock.json
generated
@ -12,6 +12,7 @@
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"mime-types": "^2.1.35",
|
||||
"minio": "^7.1.1"
|
||||
}
|
||||
},
|
||||
|
||||
@ -12,6 +12,7 @@
|
||||
"cors": "^2.8.5",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"mime-types": "^2.1.35",
|
||||
"minio": "^7.1.1"
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user