Skip to content

Commit 800982b

Browse files
authored
fix: heap snapshot file download (#30)
* fix: heap snapshot file download * docs: readme
1 parent 422294c commit 800982b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Please see each tool's source directory for additional documentation
4343
* Node.js signal handlers that provide a way to shut down long-running application components
4444
gracefully on unhandled exceptions or interrupt signals.
4545

46-
### CPU Profiler
46+
### Profiler server
4747

4848
* Fastify server that controls a profiler capable of generating:
4949
* `.cpuprofile` files for CPU usage analysis

src/profiler/server.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ const CpuProfiler: FastifyPluginCallback<Record<never, never>, Server, TypeBoxTy
155155
logger.info(
156156
`[HeapProfiler] Completed, total snapshot byte size: ${result.totalSnapshotByteSize}`
157157
);
158+
await pipeline(fs.createReadStream(tmpFile), res.raw);
158159
await res.headers({
159160
'Cache-Control': 'no-store',
160161
'Transfer-Encoding': 'chunked',
161162
'Content-Disposition': `attachment; filename="${filename}"`,
162163
'Content-Type': 'application/json; charset=utf-8',
163164
});
164-
await pipeline(fs.createReadStream(tmpFile), res.raw);
165165
} finally {
166166
const session = existingSession;
167167
existingSession = undefined;

0 commit comments

Comments
 (0)