Version: v0.0.0-...-7296e18 Latest Latest

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

Go to latest
Published: Jul 18, 2017 License: MIT Imports: 10 Imported by: 0



The file Package is meant to take care of all asset file opening so that file access is safe if trying to access a bundled file or a file from the disk



This section is empty.


This section is empty.


func CreateDirectory

func CreateDirectory(path string) error

CreateDirectory will create all directories in the path given if they do not exist

func Exists

func Exists(filename string) bool

Exists will return true if the file exists at the path provided and false if the file does not exist.

func Ext

func Ext(filename string) string

Ext will return the extention of the file

func GetLastModified

func GetLastModified(filename string) time.Time

GetLastModified will return the time of when the file was last modified, if the file does not exist the time will be 0

func GetSize

func GetSize(filename string) int32

GetSize will return the files size in bytes, it will return 0 if the file does not exist

func IsDirectory

func IsDirectory(filename string) bool

IsDirectory will return true if the path provided is a directory and false if the file does not exist or is not a directory.

func IsFile

func IsFile(filename string) bool

IsFile will return false if file does not exist or is directory. It will return true otherwise.

func IsSymLink(filename string) bool

IsSymLink will return false if the file does not exist or is not a symlink. It will return true if the file is a symlink

func NewFileData

func NewFileData(filename string) (os.FileInfo, error)

NewFileData retreives the file info for the path provided. If the file does not exist it will return an error

func Read

func Read(path string) ([]byte, error)

Read will read a file at the path specified in total and return a byte array of the file contents

func ReadString

func ReadString(filename string) string

ReadString acts like Read but instead return a string. This is useful in certain circumstances.

func Register

func Register(data string)

Register will be called by bundled assets to register the bundled files into the zip file data to be used by the program.

func Remove

func Remove(path string) error

Remove will delete a file at the given path and return an error if there was and issue


type File

type File interface {

the File interface makes accessing bundled files and os.File consistent

func Create

func Create(path string) (File, error)

Create will create and return a new empty file at the pass path

func NewFile

func NewFile(path string) (File, error)

NewFile will return the file if its bundled or on disk and return a File interface for the file and an error if it does not exist. The File interface allows for consitent access to disk files and zip files.

Source Files

Jump to

Keyboard shortcuts

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