默认为原始压缩层
This commit is contained in:
@@ -173,13 +173,13 @@ func NewImageStreamer(config *ImageStreamerConfig) *ImageStreamer {
|
|||||||
type StreamOptions struct {
|
type StreamOptions struct {
|
||||||
Platform string
|
Platform string
|
||||||
Compression bool
|
Compression bool
|
||||||
UseCompressedLayers bool // 是否保存原始压缩层,默认true
|
UseCompressedLayers bool // 是否保存原始压缩层,默认开启
|
||||||
}
|
}
|
||||||
|
|
||||||
// StreamImageToWriter 流式下载镜像到Writer
|
// StreamImageToWriter 流式下载镜像到Writer
|
||||||
func (is *ImageStreamer) StreamImageToWriter(ctx context.Context, imageRef string, writer io.Writer, options *StreamOptions) error {
|
func (is *ImageStreamer) StreamImageToWriter(ctx context.Context, imageRef string, writer io.Writer, options *StreamOptions) error {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = &StreamOptions{}
|
options = &StreamOptions{UseCompressedLayers: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
ref, err := name.ParseReference(imageRef)
|
ref, err := name.ParseReference(imageRef)
|
||||||
@@ -219,7 +219,7 @@ func (is *ImageStreamer) getImageDescriptorWithPlatform(ref name.Reference, opti
|
|||||||
// StreamImageToGin 流式响应到Gin
|
// StreamImageToGin 流式响应到Gin
|
||||||
func (is *ImageStreamer) StreamImageToGin(ctx context.Context, imageRef string, c *gin.Context, options *StreamOptions) error {
|
func (is *ImageStreamer) StreamImageToGin(ctx context.Context, imageRef string, c *gin.Context, options *StreamOptions) error {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = &StreamOptions{}
|
options = &StreamOptions{UseCompressedLayers: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
filename := strings.ReplaceAll(imageRef, "/", "_") + ".tar"
|
filename := strings.ReplaceAll(imageRef, "/", "_") + ".tar"
|
||||||
@@ -814,7 +814,7 @@ func handleImageInfo(c *gin.Context) {
|
|||||||
// StreamMultipleImages 批量下载多个镜像
|
// StreamMultipleImages 批量下载多个镜像
|
||||||
func (is *ImageStreamer) StreamMultipleImages(ctx context.Context, imageRefs []string, writer io.Writer, options *StreamOptions) error {
|
func (is *ImageStreamer) StreamMultipleImages(ctx context.Context, imageRefs []string, writer io.Writer, options *StreamOptions) error {
|
||||||
if options == nil {
|
if options == nil {
|
||||||
options = &StreamOptions{}
|
options = &StreamOptions{UseCompressedLayers: true}
|
||||||
}
|
}
|
||||||
|
|
||||||
var finalWriter io.Writer = writer
|
var finalWriter io.Writer = writer
|
||||||
|
|||||||
Reference in New Issue
Block a user