From fa9e9210ab68beb9f53af050287ef1a49c91fab3 Mon Sep 17 00:00:00 2001 From: user123456 Date: Wed, 18 Jun 2025 15:14:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=BA=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E5=8E=8B=E7=BC=A9=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/imagetar.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/imagetar.go b/src/imagetar.go index 0ae69f9..a039d46 100644 --- a/src/imagetar.go +++ b/src/imagetar.go @@ -173,13 +173,13 @@ func NewImageStreamer(config *ImageStreamerConfig) *ImageStreamer { type StreamOptions struct { Platform string Compression bool - UseCompressedLayers bool // 是否保存原始压缩层,默认true + UseCompressedLayers bool // 是否保存原始压缩层,默认开启 } // StreamImageToWriter 流式下载镜像到Writer func (is *ImageStreamer) StreamImageToWriter(ctx context.Context, imageRef string, writer io.Writer, options *StreamOptions) error { if options == nil { - options = &StreamOptions{} + options = &StreamOptions{UseCompressedLayers: true} } ref, err := name.ParseReference(imageRef) @@ -219,7 +219,7 @@ func (is *ImageStreamer) getImageDescriptorWithPlatform(ref name.Reference, opti // StreamImageToGin 流式响应到Gin func (is *ImageStreamer) StreamImageToGin(ctx context.Context, imageRef string, c *gin.Context, options *StreamOptions) error { if options == nil { - options = &StreamOptions{} + options = &StreamOptions{UseCompressedLayers: true} } filename := strings.ReplaceAll(imageRef, "/", "_") + ".tar" @@ -814,7 +814,7 @@ func handleImageInfo(c *gin.Context) { // StreamMultipleImages 批量下载多个镜像 func (is *ImageStreamer) StreamMultipleImages(ctx context.Context, imageRefs []string, writer io.Writer, options *StreamOptions) error { if options == nil { - options = &StreamOptions{} + options = &StreamOptions{UseCompressedLayers: true} } var finalWriter io.Writer = writer