fs

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Rendered for windows/amd64

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DevMapper

type DevMapper interface {
	// Convert receives the fully qualified file path and replaces the DOS device name with a drive letter.
	Convert(filename string) string
}

DevMapper is the minimal interface for the device converters.

func NewDevMapper

func NewDevMapper() DevMapper

NewDevMapper creates a new instance of the DOS device replacer.

type FileAttr

type FileAttr uint32

FileAttr represents a type alias for the file attribute enumeration.

const (
	// FileReadOnly reprsents file that is read-only. Processes can read the file, but cannot write to it or delete it.
	// This attribute is not honored on directories.
	FileReadOnly FileAttr = 0x00000001
	// FileHidden designates a file or directory that is hidden, i.e. it is not included in an ordinary directory listing.
	FileHidden FileAttr = 0x00000002
	// FileSystem is a file or directory that the operating system uses a part of, or uses exclusively.
	FileSystem FileAttr = 0x00000004
	// FileOldDosVolID is unused
	FileOldDosVolID FileAttr = 0x00000008
	// FileDirectory indicates that the file is a directory.
	FileDirectory FileAttr = 0x00000010
	// FileArchive denotes a file or directory that is an archive file or directory. Applications typically use this attribute to mark files for backup or removal.
	FileArchive FileAttr = 0x00000020
	// FileDevice attribute is reserved for system use.
	FileDevice FileAttr = 0x00000040
	// FileNormal is a file that does not have other attributes set. This attribute is valid only when used alone.
	FileNormal FileAttr = 0x00000080
	// FileTemporary denotes files that are used for temporary storage.
	FileTemporary = 0x00000100
	// FileSparse denotes a sparse file. Spare files can optimize disk usage as the system does not allocate disk space for the file regions with sparse data.
	FileSparse = 0x00000200
	// FileReparsePoint represents a file or directory that has an associated reparse point, or a file that is a symbolic link.
	FileReparsePoint FileAttr = 0x00000400
	// FileCompressed represents a file or a directory that is compressed.
	FileCompressed FileAttr = 0x00000800
	// FileOffline represents data of a file is not available immediately. This attribute indicates that the file data is physically moved to offline storage.
	FileOffline FileAttr = 0x00001000
	// FileNotContentIndexed is a file or directory is not to be indexed by the content indexing service.
	FileNotContentIndexed = 0x00002000
	// FileEncrypted represents a file or a directory that is encrypted
	FileEncrypted FileAttr = 0x00004000
	// FileIntegrityStream is the directory or user data stream is configured with integrity (only supported on ReFS volumes).
	// It is not included in an ordinary directory listing.
	FileIntegrityStream FileAttr = 0x00008000
	// FileVirtual is reserved for system use.
	FileVirtual FileAttr = 0x00010000
	// FileNoScrubData represents user data stream not to be read by the background data integrity scanner (AKA scrubber).
	// When set on a directory it only provides inheritance. This flag is only supported on Storage Spaces and ReFS volumes
	FileNoScrubData FileAttr = 0x00020000
	// FileRecallOpen attribute only appears in directory enumeration classes (FILE_DIRECTORY_INFORMATION,
	// FILE_BOTH_DIR_INFORMATION, etc.). When this attribute is set, it means that the file or directory has no physical
	// representation on the local system; the item is virtual
	FileRecallOpen FileAttr = 0x00040000
	// FileRecallAccess means that the file or directory is not fully present locally.
	// For a file that means that not all of its data is on local storage (e.g. it may be sparse with some data still in
	// remote storage). For a directory it means that some of the directory contents are being virtualized from another
	// location.
	FileRecallAccess FileAttr = 0x400000
	// FilePinned indicates user intent that the file or directory should be kept fully present locally
	// even when not being actively accessed. This attribute is for use with hierarchical storage management software.
	FilePinned FileAttr = 0x80000
	// FileUnpinned indicates that the file or directory should not be kept fully present locally except
	// when being actively accessed. This attribute is for use with hierarchical storage management software.
	FileUnpinned FileAttr = 0x100000
)

func FileAttributes added in v1.6.0

func FileAttributes(b uint32) []FileAttr

FileAttributes returns all the attributes present in the bitmask.

func (FileAttr) String

func (fa FileAttr) String() string

FileAttr returns human-readable file attribute name.

type FileDisposition

type FileDisposition uint8

FileDisposition is the alias for the file disposition modes

const (
	// Supersede dictates that if the file already exists, it is replaced with the given file. Otherwise the file with given name is created.
	Supersede FileDisposition = iota
	// Open opens the file if it already exists instead of creating a new file.
	Open
	// Create fails if the file already exists.
	Create
	// OpenIf opens the file if it already exists or creates a new file otherwise.
	OpenIf
	// Overwrite opens and overwrites the file if it already exists. Otherwise it fails.
	Overwrite
	// OverwriteIf opens and overwrites the file is it already exists. Otherwise it creates a new file.
	OverwriteIf
)

func (FileDisposition) String

func (fd FileDisposition) String() string

String returns the textual representation of the file disposition.

type FileShareMode

type FileShareMode uint8

FileShareMode designates a type alias for file share mode values

const (
	// FileShareRead allows threads to gain read access to the file
	FileShareRead FileShareMode = 1
	// FileShareWrite allows threads to gain write access to the file
	FileShareWrite FileShareMode = 1 << 1
	// FileShareDelete grants threads the possibility to delete files
	FileShareDelete FileShareMode = 1 << 2
)

func (FileShareMode) String

func (shareMode FileShareMode) String() string

String returns user-friendly representation of the file share mask.

type FileType

type FileType uint8

FileType is the the type alias for the file type

const (
	// Regular represents the file, volume or hard disk device
	Regular FileType = iota
	// Directory represents the directory
	Directory
	// Pipe represent the pipe
	Pipe
	// Console denotes the standard output stream
	Console
	// Mailslot denotes a mail slot file
	Mailslot
	// Other is the file type different from listed above
	Other
	// Unknown is the unknown file type
	Unknown
)

func GetFileType

func GetFileType(filename string, opts uint32) FileType

GetFileType returns the underlying file type. The opts parameter corresponds to the NtCreateFile CreateOptions argument that specifies the options to be applied when creating or opening the file.

func (FileType) String

func (typ FileType) String() string

String returns the textual representation of the file type.

Jump to

Keyboard shortcuts

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