ose

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	O_RDONLY = os.O_RDONLY // open the file read-only.
	O_WRONLY = os.O_WRONLY // open the file write-only.
	O_RDWR   = os.O_RDWR   // open the file read-write.
	O_APPEND = os.O_APPEND // append data to the file when writing.
	O_CREATE = os.O_CREATE // create a new file if none exists.
	O_EXCL   = os.O_EXCL   // used with O_CREATE, file must not exist
	O_SYNC   = os.O_SYNC   // open for synchronous I/O.
	O_TRUNC  = os.O_TRUNC  // if possible, truncate file when opened.

)

Variables

This section is empty.

Functions

func Mkdir

func Mkdir(name string, mode os.FileMode) error

Mkdir creates the named directory.

func MkdirAll

func MkdirAll(name string, mode os.FileMode) error

MkdirAll creates the named directory and all path elements leading to it.

func Remove

func Remove(name string) error

Remove removes the named file.

func RemoveAll

func RemoveAll(subtree string) error

RemoveAll is a recursive remove.

func Rename

func Rename(from, to string) error

Rename renames file 'from' to 'to'.

func Truncate

func Truncate(name string, size int64) error

Truncate shortens a file.

Types

type File

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

File represents an encrypted file. There are no holes, in other words the disk file is not sparse.

func Create

func Create(name string) (*File, error)

Create creates an encrypted file.

func OpenFile

func OpenFile(name string, flag int, mode os.FileMode) (*File, error)

OpenFile opens an encrypted file.

func (*File) Close

func (file *File) Close() error

Close closes a file. If the ref count goes to zero, the file is removed.

func (*File) Pin

func (file *File) Pin()

Pin increases the reference count so the file will not be removed.

func (*File) ReadAt

func (file *File) ReadAt(b []byte, off int64) (int, error)

ReadAt performs a random access read of an encrypted file and returns the decrypted content.

func (*File) Stat

func (file *File) Stat() (os.FileInfo, error)

Stat returns the status of a file.

func (*File) WriteAt

func (file *File) WriteAt(b []byte, off int64) (int, error)

WriteAt encrypts the content and writes it to the file. Unlike os.WriteAt, this changes the contents of b.

Jump to

Keyboard shortcuts

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