file

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlobAccess

func BlobAccess(mime string, path string, fss ...vfs.FileSystem) bpi.BlobAccess

BlobAccess wraps a file path into a BlobAccess, which does not need a close.

func BlobAccessForTemporaryFile

func BlobAccessForTemporaryFile(mime string, temp vfs.File, opts ...Option) bpi.BlobAccess

func BlobAccessForTemporaryFilePath

func BlobAccessForTemporaryFilePath(mime string, temp string, opts ...Option) bpi.BlobAccess

func BlobAccessWithCloser

func BlobAccessWithCloser(closer io.Closer, mime string, path string, fss ...vfs.FileSystem) bpi.BlobAccess

func DataAccess

func DataAccess(fs vfs.FileSystem, path string) bpi.DataAccess

func Provider

func Provider(mime string, path string, fss ...vfs.FileSystem) bpi.BlobAccessProvider

Types

type Option

type Option = optionutils.Option[*Options]

func WithDigest

func WithDigest(d digest.Digest) Option

func WithFileSystem

func WithFileSystem(fss ...vfs.FileSystem) Option

func WithSize

func WithSize(s int64) Option

type Options

type Options struct {
	// FileSystem defines the file system that contains the specified directory.
	FileSystem vfs.FileSystem
	Digest     digest.Digest
	Size       *int64
}

func (*Options) ApplyTo

func (o *Options) ApplyTo(opts *Options)

func (*Options) GetSize

func (o *Options) GetSize() int64

type TempFile

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

TempFile holds a temporary file that should be kept open. Close should never be called directly. It can be passed to another responsibility realm by calling Release- For example to be transformed into a TemporaryBlobAccess. Close will close and remove an unreleased file and does nothing if it has been released. If it has been released the new realm is responsible. to close and remove it.

func NewTempFile

func NewTempFile(dir string, pattern string, fss ...vfs.FileSystem) (*TempFile, error)

func (*TempFile) AsBlob

func (t *TempFile) AsBlob(mime string) bpi.BlobAccess

func (*TempFile) Close

func (t *TempFile) Close() error

Close closes and removes the temporary file as long it has not been released before by calling Release.

func (*TempFile) FileSystem

func (t *TempFile) FileSystem() vfs.FileSystem

func (*TempFile) Name

func (t *TempFile) Name() string

func (*TempFile) Release

func (t *TempFile) Release() vfs.File

Release passes the responsibility for closing and removing the temporary file to another realm. After calling this method the TempFile object will not handle these operations anymore, if it is closed.

func (*TempFile) Sync

func (t *TempFile) Sync() error

func (*TempFile) Writer

func (t *TempFile) Writer() io.Writer

Jump to

Keyboard shortcuts

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