Skip to content

Commit

Permalink
feat: enhance logging for bucket(-file) streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
tada5hi committed Jul 2, 2024
1 parent 67e06c1 commit c94bd52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export async function executeBucketFileRouteStreamHandler(req: Request, res: Res

const minio = useMinio();
const stream = await minio.getObject(bucketName, entity.hash);

stream.on('end', () => {
useLogger().debug(`Streamed file ${entity.hash} (${id}) of ${bucketName}`);
});
stream.pipe(res);
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ async function packFile(
minio.getObject(name, file.hash)
.then((stream) => streamToBuffer(stream))
.then((data) => {
useLogger().debug(`Packing file ${file.path} (${file.id})`);

pack.entry({
name: file.path,
size: data.byteLength,
Expand Down Expand Up @@ -102,4 +104,6 @@ export async function executeBucketRouteStreamHandler(req: Request, res: Respons
useLogger().debug(`Streaming files of ${bucketName}`);

await streamFiles(res, bucketName, files);

useLogger().debug(`Streamed files of ${bucketName}`);
}

0 comments on commit c94bd52

Please sign in to comment.