util

package
v0.0.0-...-4a1ec1a Latest Latest
Warning

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

Go to latest
Published: May 31, 2022 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent = "mcinstall/0.1.0"
)

Variables

This section is empty.

Functions

func BuildClasspath

func BuildClasspath(files ...string) string

Creates a classpath string for the given files appropriate to the operating system currently running. For example, on macOS using BuildClasspath("x.jar", "y.jar") the output would be "x.jar:y.jar". However on Windows, the output would be "x.jar;y.jar".

func CopyZipFileToDisk

func CopyZipFileToDisk(file *zip.File, dest string) error

Reads the given zip file, and writes it to the given destination.

func Download

func Download(dst io.Writer, req *http.Request) error

Downloads the file, copying it to the given writer.

func DownloadTemp

func DownloadTemp(req *http.Request, pattern string) (*os.File, error)

Downloads the file, copying it to the given writer. The temporary file should be removed after usage.

func ExtractZipFileToDisk

func ExtractZipFileToDisk(zipFile *zip.Reader, dest string) error

Extracts the given zip file to the local file system.

func GetClasspathSeparator

func GetClasspathSeparator() string

Gets the classpath separator for the operating system currently running.

func GetFileInZip

func GetFileInZip(zipFile *zip.Reader, name string) (*zip.File, error)

Gets the *zip.File of the given name in the given zip file.

func MergeZips

func MergeZips(into *zip.Writer, from *zip.Reader, files []string, filter func(string) bool) ([]string, error)

func NewRequest

func NewRequest(method, url string, body io.Reader) (*http.Request, error)

See http.NewRequest Populates the Header with our User-Agent

func RunCommand

func RunCommand(name string, arg ...string) error

Runs the given program, with given arguments, outputting to the console of this program.

Types

This section is empty.

Jump to

Keyboard shortcuts

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