file

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package file provides a version of os.OpenFile, the handles of which can be renamed and deleted under Windows.

Index

Constants

View Source
const PreallocateImplemented = true

PreallocateImplemented is a constant indicating whether the implementation of Preallocate actually does anything.

View Source
const SetSparseImplemented = false

SetSparseImplemented is a constant indicating whether the implementation of SetSparse actually does anything.

Variables

View Source
var ErrDiskFull = errors.New("preallocate: file too big for remaining disk space")

ErrDiskFull is returned from PreAllocate when it detects disk full

View Source
var OpenFile = os.OpenFile

OpenFile is the generalized open call; most users will use Open or Create instead. It opens the named file with specified flag (O_RDONLY etc.) and perm (before umask), if applicable. If successful, methods on the returned File can be used for I/O. If there is an error, it will be of type *PathError.

Under both Unix and Windows this will allow open files to be renamed and or deleted.

Functions

func Create

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

Create creates the named file with mode 0666 (before umask), truncating it if it already exists. If successful, methods on the returned File can be used for I/O; the associated file descriptor has mode O_RDWR. If there is an error, it will be of type *PathError.

func FindUnusedDriveLetter

func FindUnusedDriveLetter() (driveLetter uint8)

FindUnusedDriveLetter does nothing except on Windows.

func IsReserved

func IsReserved(path string) error

IsReserved checks if path contains a reserved name

func MkdirAll

func MkdirAll(path string, perm os.FileMode) error

MkdirAll just calls os.MkdirAll on non-Windows and with go1.22 or newer on Windows

func Open

func Open(name string) (*os.File, error)

Open opens the named file for reading. If successful, methods on the returned file can be used for reading; the associated file descriptor has mode O_RDONLY. If there is an error, it will be of type *PathError.

func PreAllocate

func PreAllocate(size int64, out *os.File) (err error)

PreAllocate the file for performance reasons

func SetSparse

func SetSparse(out *os.File) error

SetSparse makes the file be a sparse file

func UNCPath

func UNCPath(l string) string

UNCPath converts an absolute Windows path to a UNC long path.

It does nothing on non windows platforms

Types

This section is empty.

Jump to

Keyboard shortcuts

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