part

package
v1.5.0-rc11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

part package implements a ReadWriteCloser to write data into multi parts and read data from different parts

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PartHelper

type PartHelper struct {
	// Filename is the file name of the compressed file
	Filename string

	// Size is the maximum size of each part of tarball,
	// multi-part archive will be ignored if size is 0
	Size int
	// contains filtered or unexported fields
}

PartHelper implements io.ReadWriteCloser to write file into different part (.part*), and read from it.

func NewPartHelper

func NewPartHelper(file string, size int) *PartHelper

NewPartHelper create a new PartHelper

file is the filename of the compressed file (without .part* extension)
size is the maximum size of each part to write, 0 to disable

func (*PartHelper) Close

func (c *PartHelper) Close() error

Close closes the current opening file and reset the status of PartHelper

func (*PartHelper) Part

func (c *PartHelper) Part() int

Part gets part num of PartHelper

func (*PartHelper) Read

func (c *PartHelper) Read(p []byte) (int, error)

Read implements io.Reader

func (*PartHelper) Write

func (c *PartHelper) Write(p []byte) (int, error)

Write implements io.Writer

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL