osutil

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package osutil implements operating system utility functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenFile

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

OpenFile behaves the same as os.OpenFile, except on Windows it sets syscall.FILE_SHARE_DELETE.

See: https://go.dev/issue/32088#issuecomment-502850674

Types

type FS

type FS struct{}

FS implements fs.FS, fs.StatFS, and fs.ReadFileFS using package os.

This filesystem does not respect fs.ValidPath rules, and fails testing/fstest.TestFS!

Still, it can be a useful tool to unify implementations that can access either the os filesystem or an fs.FS. It's OK to use this to open files, but you should avoid opening directories, resolving paths, or walking the file system.

func (FS) Open

func (FS) Open(name string) (fs.File, error)

Open implements fs.FS.

func (FS) ReadFile

func (FS) ReadFile(name string) ([]byte, error)

ReadFile implements fs.ReadFileFS.

func (FS) Stat

func (FS) Stat(name string) (fs.FileInfo, error)

ReadFileFS implements fs.StatFS.

Jump to

Keyboard shortcuts

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