Documentation ¶
Index ¶
- Constants
- Variables
- func CheckForNewCLIVersion(client HTTPClient) string
- func GenerateFileHashStr(fName string) (string, error)
- func GetContentTypeByExtension(ext string) (string, bool)
- func GetDirectoryContainingFile(wd, filename string) (string, error)
- func IsDefaultContentType(cType string) bool
- func RandomAlphaNumericSpecialString(length int) string
- func RandomAlphaNumericSpecialStringStrict(length int) string
- func RandomAlphaNumericString(length int) string
- func RandomAlphaString(length int) string
- func ResolveAppDirectory(appPath, workingDirectory string) (string, error)
- func ResolveAppInstanceData(appID, path string) (models.AppInstanceData, error)
- func TraverseArchiveReader(archiveReader ArchiveReader, fileHandler func(header *FileHeader) error) error
- func UnmarshalFromDir(path string) (map[string]interface{}, error)
- func WriteFileToDir(dest string, data io.Reader) error
- func WriteZipToDir(dest string, zipData io.Reader, overwrite bool) error
- type ArchiveInputReader
- type ArchiveReader
- func NewArchiveReader(r ArchiveInputReader, fullPath string, size int64) (ArchiveReader, error)
- func NewDirReader(dirName string) (ArchiveReader, error)
- func NewGZReader(r io.Reader) (ArchiveReader, error)
- func NewTarReader(r io.Reader) ArchiveReader
- func NewZipReader(r io.ReaderAt, size int64) (ArchiveReader, error)
- type FileHeader
- type HTTPClient
- type MediaType
Constants ¶
const ( MediaTypeTextPlain = MediaType("text/plain; charset=utf-8") MediaTypeOctetStream = MediaType("application/octet-stream") MediaTypeHTML = MediaType("text/html") MediaTypeJSON = MediaType("application/json") MediaTypeMultipartFormData = MediaType("multipart/form-data") MediaTypeFormURLEncoded = MediaType("application/x-www-form-urlencoded") MediaTypeZip = MediaType("application/zip") )
The set of known MediaTypes
const (
// FunctionsRoot is the root directory for functions and dependencies
FunctionsRoot = "functions"
)
Variables ¶
var ( // HostingRoot is the root directory for hosting assets and attributes HostingRoot = "hosting" // HostingFilesDirectory is the directory to place the static hosting assets HostingFilesDirectory = fmt.Sprintf("%s/files", HostingRoot) // HostingAttributes is the file that stores the static hosting asset descriptions struct HostingAttributes = fmt.Sprintf("%s/metadata.json", HostingRoot) // HostingCacheFileName is the file that stores the cached hosting asset data HostingCacheFileName = ".asset-cache.json" )
var ( // CLIVersion represents the current version of the CLI. This version is dynamically replaced at build-time CLIVersion = "1.0.0" // CLIOSArch represents the OS Architecture of the CLI. It is used to select the appropriate URL for the CLI // binary based on the user's OS CLIOSArch string )
Functions ¶
func CheckForNewCLIVersion ¶
func CheckForNewCLIVersion(client HTTPClient) string
CheckForNewCLIVersion looks for and returns a url for a new version of the CLI, if one exists. Any errors are swallowed.
func GenerateFileHashStr ¶
GenerateFileHashStr takes a file name and opens and generates a string of the hash.Hash for that file
func GetContentTypeByExtension ¶
GetContentTypeByExtension takes an extension (String) and outputs the default content type used to represent it
func GetDirectoryContainingFile ¶
GetDirectoryContainingFile searches upwards for a valid Realm app directory
func IsDefaultContentType ¶
IsDefaultContentType that takes a content / MIME type and outputs if it is one of the default content-types in fileName
func RandomAlphaNumericSpecialString ¶
RandomAlphaNumericSpecialString generates a new random alphanumeric key with special characters
func RandomAlphaNumericSpecialStringStrict ¶
RandomAlphaNumericSpecialStringStrict generates a new random alphanumeric key with special characters
func RandomAlphaNumericString ¶
RandomAlphaNumericString generates a new random alphanumeric key
func RandomAlphaString ¶
RandomAlphaString generates a new random alphabetic string of given length
func ResolveAppDirectory ¶
ResolveAppDirectory returns the directory path for an app
func ResolveAppInstanceData ¶
func ResolveAppInstanceData(appID, path string) (models.AppInstanceData, error)
ResolveAppInstanceData loads data for an app from a config.json file located in the provided directory path, merging in any overridden parameters from command line flags
func TraverseArchiveReader ¶
func TraverseArchiveReader(archiveReader ArchiveReader, fileHandler func(header *FileHeader) error) error
TraverseArchiveReader traverses the archive reader while invoking the provided handler for each new file
func UnmarshalFromDir ¶
UnmarshalFromDir unmarshals a Realm app from the given directory into a map[string]interface{}
func WriteFileToDir ¶
WriteFileToDir writes the data to dest and creates the necessary directories along the path
Types ¶
type ArchiveInputReader ¶
ArchiveInputReader is an interface that wraps Reader and ReaderAt.
type ArchiveReader ¶
type ArchiveReader interface { Next() (*FileHeader, error) Read(b []byte) (int, error) }
ArchiveReader provides sequential access to the contents of the supported archive formats. Reader.Next advances to the next file in the archive (including the first), and then ArchiveReader can be treated as an io.Reader to access the file's data.
func NewArchiveReader ¶
func NewArchiveReader(r ArchiveInputReader, fullPath string, size int64) (ArchiveReader, error)
NewArchiveReader creates a new ArchiveReader reading from r.
func NewDirReader ¶
func NewDirReader(dirName string) (ArchiveReader, error)
NewDirReader creates a new dir reader by traversing through all the files in the directory
func NewGZReader ¶
func NewGZReader(r io.Reader) (ArchiveReader, error)
NewGZReader creates a new gzip archive reader reading from r
func NewTarReader ¶
func NewTarReader(r io.Reader) ArchiveReader
NewTarReader creates a new tar archive reader reading from r
func NewZipReader ¶
func NewZipReader(r io.ReaderAt, size int64) (ArchiveReader, error)
NewZipReader creates a new zip archive reader reading from r
type FileHeader ¶
type FileHeader struct { FullPath string // contains filtered or unexported fields }
FileHeader holds file header information
func (*FileHeader) FileInfo ¶
func (header *FileHeader) FileInfo() os.FileInfo
FileInfo returns an os.FileInfo for the FileHeader.
type HTTPClient ¶
HTTPClient represents the minimum HTTP client required to check for version information