fileutil

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package fileutil provides cross-platform secure file operations. On Unix, these are thin wrappers around the standard os functions. On Windows, owner-only modes (perm & 0077 == 0) additionally set a DACL restricting access to the current user.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SecureChmod

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

SecureChmod changes the mode of the named file. On Windows, owner-only modes get a restrictive DACL.

func SecureMkdirAll

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

SecureMkdirAll creates a directory path and all parents that do not yet exist. On Windows, owner-only modes get a restrictive DACL.

func SecureOpenFile

func SecureOpenFile(path string, flag int, perm os.FileMode) (*os.File, error)

SecureOpenFile opens the named file with specified flag and permissions. On Windows, owner-only modes with O_CREATE get a restrictive DACL.

func SecureWriteFile

func SecureWriteFile(path string, data []byte, perm os.FileMode) error

SecureWriteFile writes data to the named file, creating it if necessary. On Windows, owner-only modes get a restrictive DACL.

Types

This section is empty.

Jump to

Keyboard shortcuts

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