fileopt

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package fileopt provides small filesystem read, write, and creation helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirExistOrCreate

func DirExistOrCreate(dirPath string) error

DirExistOrCreate creates dirPath and parent directories when they are missing.

func FileGetContents

func FileGetContents(filename string) ([]byte, error)

FileGetContents reads filename and returns its contents.

func FilePutContents

func FilePutContents[DType string | []byte](filename string, data DType, isAppend ...bool) error

FilePutContents writes data to filename, creating parent directories as needed.

func GetContents

func GetContents(filename string) ([]byte, error)

GetContents reads filename and returns its contents.

func IsExist

func IsExist(path string) bool

IsExist reports whether path exists.

func IsExistOrCreate

func IsExistOrCreate[T string | []byte](path string, init ...T) error

IsExistOrCreate creates path with optional initial content when it is missing.

func PutContents

func PutContents[DType string | []byte](filename string, data DType, isAppend ...bool) error

PutContents writes data to filename, appending when isAppend is true.

Types

This section is empty.

Jump to

Keyboard shortcuts

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