Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SizeKB represents one Kibibyte SizeKB = 1 << (10 * iota) // SizeMB represents one Mebibyte (1024 KiB) SizeMB // SizeGB represents one Gibibyte (1024 MiB) SizeGB )
TODO(leon): It's {K,M,G}iB, not {K,M,G}B (with an "i")
View Source
const ( // DefaultSize specifies the default size for a RAM disk in MB DefaultSize = 4 * SizeMB )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CleanupFunc ¶
type CleanupFunc func()
func TempDir ¶
func TempDir(size int) (string, CleanupFunc, error)
TempDir creates a new RAM disk with size 'size' (in bytes) and returns the path to it. Use this function only if you intend to create multiple files inside your RAM disk, else prefer to use 'TempFile'.
func TempFile ¶
func TempFile(size int) (*os.File, CleanupFunc, error)
TempFile creates a new RAM disk with size 'size' (in bytes), creates a temp file in it and returns a pointer to that file. Use this function only if you intend to create a single file inside your RAM disk, else prefer to use 'TempDir'.
Click to show internal directories.
Click to hide internal directories.