mod

package
v0.0.0-...-73c17ce Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIllegalPathError

func IsIllegalPathError(err error) bool

IsIllegalPathError returns true if the provided error is of the type IllegalPathError.

func NewJsMod

func NewJsMod() *jsMod

func NewJsSum

func NewJsSum() *jsSum

func NewMod

func NewMod() *mod

func NewModInfo

func NewModInfo(name, version string) *modInfo

func NewPackageJson

func NewPackageJson() *packageJSON

NewPackageJson 每个包都要获取他的packages

Types

type File

type File struct {
	os.FileInfo

	// The original header info; depends on
	// type of archive -- could be nil, too.
	Header interface{}

	// Allow the file contents to be read (and closed)
	io.ReadCloser
}

File provides methods for accessing information about or contents of a file within an archive.

type IllegalPathError

type IllegalPathError struct {
	AbsolutePath string
	Filename     string
}

IllegalPathError is an error returned when an illegal path is detected during the archival process.

By default, only the Filename is showed on error, but you might also get the absolute value of the invalid path on the AbsolutePath field.

func (*IllegalPathError) Error

func (err *IllegalPathError) Error() string

type JsSumAbs

type JsSumAbs interface {
	FetchRootModMeta(map[string]string) *jsSum
	PrunerAndFetcher(path ...string) *jsSum
	GetJsSum() *jsSum
	WriteFile() *jsSum
}

type ReadFakeCloser

type ReadFakeCloser struct {
	io.Reader
}

ReadFakeCloser is an io.Reader that has a no-op close method to satisfy the io.ReadCloser interface.

func (ReadFakeCloser) Close

func (rfc ReadFakeCloser) Close() error

Close implements io.Closer.

type Tar

type Tar struct {
	// Whether to overwrite existing files; if false,
	// an error is returned if the file exists.
	OverwriteExisting bool

	// Whether to make all the directories necessary
	// to create a tar archive in the desired path.
	MkdirAll bool

	// A single top-level folder can be implicitly
	// created by the Archive or Unarchive methods
	// if the files to be added to the archive
	// or the files to be extracted from the archive
	// do not all have a common root. This roughly
	// mimics the behavior of archival tools integrated
	// into OS file browsers which create a subfolder
	// to avoid unexpectedly littering the destination
	// folder with potentially many files, causing a
	// problematic cleanup/organization situation.
	// This feature is available for both creation
	// and extraction of archives, but may be slightly
	// inefficient with lots and lots of files,
	// especially on extraction.
	ImplicitTopLevelFolder bool

	// Strip number of leading paths. This feature is available
	// only during unpacking of the entire archive.
	StripComponents int

	// If true, errors encountered during reading
	// or writing a single file will be logged and
	// the operation will continue on remaining files.
	ContinueOnError bool
	// contains filtered or unexported fields
}

Tar provides facilities for operating TAR archives. See http://www.gnu.org/software/tar/manual/html_node/Standard.html.

func NewTar

func NewTar() *Tar

NewTar returns a new, default instance ready to be customized and used.

func (*Tar) CheckPath

func (*Tar) CheckPath(to, filename string) error

CheckPath ensures that the filename has not been crafted to perform path traversal attacks

func (*Tar) Close

func (t *Tar) Close() error

Close closes the tar archive(s) opened by Create and Open.

func (*Tar) IOUnTar

func (t *Tar) IOUnTar(reader io.ReadCloser, destination string) error

func (*Tar) Open

func (t *Tar) Open(in io.Reader, size int64) error

Open opens t for reading an archive from in. The size parameter is not used.

func (*Tar) Read

func (t *Tar) Read() (File, error)

Read reads the next file from t, which must have already been opened for reading. If there are no more files, the error is io.EOF. The File must be closed when finished reading from it.

func (*Tar) UnTar

func (t *Tar) UnTar(source, destination string) error

type TarGz

type TarGz struct {
	*Tar
	// contains filtered or unexported fields
}

TarGz facilitates gzip compression (RFC 1952) of tarball archives.

func DefaultTarGz

func DefaultTarGz() *TarGz

DefaultTarGz 针对npm下载的默认设置,一个有问题需要调整下载参数

func (*TarGz) IOUnTarGz

func (tgz *TarGz) IOUnTarGz(reader io.ReadCloser, destination string) error

func (*TarGz) UnTarGz

func (tgz *TarGz) UnTarGz(source, destination string) error

Jump to

Keyboard shortcuts

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