Merge remote-tracking branch 'origin/api-v1.5.5' into dev
This commit is contained in:
commit
72b9cf4cee
1 changed files with 8 additions and 14 deletions
|
|
@ -15,20 +15,14 @@ async function createHeapSnapshot() {
|
||||||
|
|
||||||
async function sendHeapSnapshot(req, res) {
|
async function sendHeapSnapshot(req, res) {
|
||||||
const fileName = await createHeapSnapshot();
|
const fileName = await createHeapSnapshot();
|
||||||
const file = fs.readFileSync(location + fileName, 'binary');
|
res.download(location + fileName, function (err) {
|
||||||
const stat = fs.statSync(location + fileName);
|
try {
|
||||||
|
fs.unlinkSync(location + fileName)
|
||||||
res.setHeader('Content-Length', stat.size);
|
} catch (err) {
|
||||||
res.setHeader('Content-Type', 'audio/mpeg');
|
console.error("error while deleting heapsnapshot file");
|
||||||
res.setHeader('Content-Disposition', 'attachment; filename=' + fileName);
|
console.error(err);
|
||||||
res.write(file, 'binary');
|
}
|
||||||
res.end();
|
});
|
||||||
try {
|
|
||||||
fs.unlinkSync(location + fileName)
|
|
||||||
} catch (err) {
|
|
||||||
console.error("error while deleting heapsnapshot file");
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process.on('USR2', () => {
|
process.on('USR2', () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue