fs

package
v0.0.0-...-5ada688 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLatestFileByModTime

func GetLatestFileByModTime(path string) (string, error)

GetLatestFileByModTime 获取最新的文件,基于文件的修改时间

func GetLatestFileByName

func GetLatestFileByName(path string) (string, error)

GetLatestFileByName 获取最新的文件,基于文件名中的时戳

func ReadCSVFile

func ReadCSVFile(path string, out any) error

ReadCSVFile 从最新的 CSV 文件中读取数据

func ReadFile

func ReadFile(path string, out any, unmarshal ...unmarshal) error

ReadFile 从最新的文件中读取数据,没有指定 unmarshal 时,会根据后缀名自动选择对应类型的 unmarshal

func ReadJsonFile

func ReadJsonFile(path string, out any) error

ReadJsonFile 从最新的 JSON 文件中读取数据

func ReadYAMLFile

func ReadYAMLFile(path string, out any) error

ReadYAMLFile 从最新的 YAML 文件中读取数据

func SaveFile

func SaveFile(path string, data any, optFns ...fsutil.OpenOptionFunc) error

func TimestampFileName

func TimestampFileName(path string) string

TimestampFileName 将 path 中的 * 替换为当前时间戳(格式为 20060102_150405)

func WriteCSVFile

func WriteCSVFile(path string, data any) error

WriteCSVFile 将 data 写入到 CSV 文件中,如果 path 中包含 *,则会替换为当前时间戳(格式为 20060102_150405)

func WriteFile

func WriteFile(path string, data any, marshal ...marshal) error

WriteFile 将 data 写入到文件中,如果 path 中包含 *,则会替换为当前时间戳(格式为 20060102_150405)

func WriteJsonFile

func WriteJsonFile(path string, data any) error

WriteJsonFile 将 data 写入到 JSON 文件中,如果 path 中包含 *,则会替换为当前时间戳(格式为 20060102_150405)

func WriteYAMLFile

func WriteYAMLFile(path string, data any) error

WriteYAMLFile 将 data 写入到 YAML 文件中,如果 path 中包含 *,则会替换为当前时间戳(格式为 20060102_150405)

Types

This section is empty.

Jump to

Keyboard shortcuts

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