fsutil

package
v1.0.0-rc.57 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package fsutil 读本机磁盘的剩余空间(媒体中心 M8 的首页存储与系统体检)。

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("这个系统上读不了磁盘空间")

ErrUnsupported 表示这个系统上读不了磁盘空间。

Functions

func LowSpace

func LowSpace(free, total uint64) bool

LowSpace 报告剩余空间是不是低于警告线(总量的 5% 或 20 GB,先到哪条算哪条)。总量不知道(0)时只看 20 GB。

Types

type Usage

type Usage struct {
	Free   uint64 `json:"free"`
	Total  uint64 `json:"total"`
	Device string `json:"-"`
}

Usage 是一个路径所在磁盘的空间:Free 是当前用户能用的剩余字节,Total 是总字节;Device 认同一块盘(两个路径的 Device 一样时在 同一个文件系统上,首页按它去重,硬链接也只能在同一块盘里建)。

func DiskUsage

func DiskUsage(path string) (Usage, error)

DiskUsage 读 path 所在磁盘的空间(path 要存在)。

Jump to

Keyboard shortcuts

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