fileKit

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(filePath string) error

CreateFile 创建文件 *

  • @param filePath 文件路径
  • @return error

func CreateLazyFile added in v0.2.14

func CreateLazyFile(filePath string) error

CreateLazyFile 一次性创建好文件和文件夹

  • @param filePath 文件路径

func Exists

func Exists(path string) bool

Exists 文件或文件夹是否存在 *

  • @param path 文件或文件夹路径
  • @return bool true 存在 false 不存在

func FileDirSize

func FileDirSize(path string) (int, error)

FileDirSize 获取文件/文件夹下所有文件的大小[byte] *

  • @param path 文件/文件夹路径
  • @return 文件大小[byte], 错误信息

func GetCurrentAbPath added in v0.2.3

func GetCurrentAbPath() string

GetCurrentAbPath 获取当前执行文件绝对路径

func GetFileTotalLines

func GetFileTotalLines(filePath string) (int, error)

GetFileTotalLines 获取文件总行数 *

  • 注意:
  • 1. 读取大文件时,会消耗大量内存
  • 2. 读取商业加密文本时行数上面会异常
  • 3. 空白行不会被计算
  • @param filePath 文件路径
  • @return 文件总行数, 错误信息

func HomeDir added in v0.2.14

func HomeDir(ctx context.Context) (string, error)

HomeDir 获取系统当前使用的用户的主目录

  • eg: /Users/symbol
  • @param ctx 上下文
  • @return string,error

func SaveFile

func SaveFile(filePath, fileName, content string) error

SaveFile 保存信息到文件 *

  • @param filePath 文件夹路径
  • @param fileName 文件名,如果文件名不存在,那么默认文件夹路径是包涵文件名的
  • @param content 文件内容
  • @return error

func Unzip added in v0.2.16

func Unzip(zipFile, destDir string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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