Discover Packages
github.com/Decsr/Decsr-Code
internal
safefile
package
Version:
v0.1.0
Opens a new window with list of versions in this module.
Published: Oct 27, 2026
License: MIT
Opens a new window with license information.
Imports: 2
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
Documentation
¶
func OpenFile(rootDir, name string, flag int, perm os.FileMode) (*os.File, error)
func ReadFile(rootDir, name string) ([]byte, error)
func Stat(rootDir, name string) (os.FileInfo, error)
func WriteFile(rootDir, name string, data []byte, perm os.FileMode) error
OpenFile opens a file within rootDir with given flags using os.Root.
The returned *os.File is independent and safe to use after this function returns.
ReadFile reads a file within rootDir using os.Root to prevent directory traversal.
The name must be a relative path within rootDir.
Stat returns FileInfo for a file scoped within rootDir using os.Root.
WriteFile writes data to a file within rootDir using os.Root to prevent
directory traversal. The file is created or truncated with the given permissions.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.