fileargs

package
v0.0.0-...-0f8ce4c Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultSize = 4 * 1024 * 1024

DefaultSize is the default size limit for FileArgs

Variables

View Source
var TempDirectory = os.TempDir()

TempDirectory is the directory where FileArgs will mount the actual files to. Defaults to os.TempDir() but can be globally overridden by the application before any FileArgs are used.

Functions

This section is empty.

Types

type FileArgs

type FileArgs struct {
	// contains filtered or unexported fields
}

func New

func New() (*FileArgs, error)

New initializes a new set of file-based arguments. Remember to call Close() if you're done using it, otherwise this leaks memory and mounts.

func NewWithSize

func NewWithSize(size uint64) (*FileArgs, error)

NewWithSize is the same as new, but with a custom size limit. Please be aware that this data cannot be swapped out and using a size limit that's too high can deadlock your kernel.

func (*FileArgs) ArgPath

func (f *FileArgs) ArgPath(name string, content []byte) string

ArgPath returns the path of the temporary file for this argument. It names the temporary file according to name.

func (*FileArgs) Close

func (f *FileArgs) Close() error

func (*FileArgs) Error

func (f *FileArgs) Error() error

func (*FileArgs) FileOpt

func (f *FileArgs) FileOpt(optName, fileName string, content []byte) string

FileOpt returns a full option with the temporary file name already filled in. Example:

option := FileOpt("--testopt", "test.txt", []byte("hello")) option == "--testopt=/tmp/daf8ed.../test.txt"

Jump to

Keyboard shortcuts

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