https://github.com/wux1an/go-size
Print humans readable file size
https://github.com/wux1an/go-size
file file-size humans readable size
Last synced: about 1 month ago
JSON representation
Print humans readable file size
- Host: GitHub
- URL: https://github.com/wux1an/go-size
- Owner: wux1an
- Created: 2021-10-21T11:48:06.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2021-11-01T13:37:44.000Z (over 4 years ago)
- Last Synced: 2025-12-31T05:58:57.170Z (5 months ago)
- Topics: file, file-size, humans, readable, size
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-size
print humans readable file size
# Install
```bash
go get -u github.com/wux1an/go-size
```
# Usage
```golang
package main
import (
"fmt"
"github.com/wux1an/go-size"
)
func main() {
fmt.Println(0 * size.Byte)
fmt.Println(1 * size.Byte)
fmt.Println(2*size.Byte + 1*size.Bit)
fmt.Println(20*size.KB + 512*size.Byte)
fmt.Println(200*size.MB + 1024*size.KB)
fmt.Println(1024 * 10000 * size.GB)
}
```
output
```
0 Bit
1 Byte
2 Byte
20.5 KB
201 MB
9.8 PB
```