byten

package module
v0.0.0-...-f847a13 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2014 License: MIT Imports: 2 Imported by: 16 modules, 17 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.

README

byten

Bit the size of file and turn it into human readable format.

This is a Go Package that convert size of file into human readable format.

Another weekend project by pyk.

Usage

First thing first, get the remote package

$ go get github.com/pyk/byten

and import package into your project

import "github.com/pyk/byten"

then bite the bytes!

byten.Size(1024) # => 1.0KB
byten.Size(206848) # => 202KB
byten.Size(10239999998976) # => 9.3TB
byten.Size(6314666666666665984) # => 5.5EB

easy huh? =))

Docs

Nothing fancy, but you can see here

License

MIT License

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Size

func Size(s int64) string

Size return a formated string from file size

Example (SizeOfCurrentFile)
// get FileInfo
file, err := os.Stat("size_example.go")
if err != nil {
	log.Fatal(err)
}

fmt.Println(Size(file.Size()))
Output:
237B

Types

This section is empty.

Jump to

Keyboard shortcuts

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