file

package
v0.0.0-...-b105b8e Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToBytes

func Base64ToBytes(s string) []byte

Base64ToBytes converte uma string em base64 para bytes

func Base64ToString

func Base64ToString(s string) string

Base64ToString converte string no formato base64 para string normal

func ByteToBase64

func ByteToBase64(b []byte) string

ByteToBase64 converte arquivo em byte para base64

func CreateDirIfNotExists

func CreateDirIfNotExists(dir string) (err error)

CreateDirIfNotExists cria uma diretorio no caminho especificado caso o mesmo nao exista

func CreateFile

func CreateFile(file []byte, filePath string) (err error)

func CreateTempFile

func CreateTempFile(file []byte, fileNameExt string) (path string, err error)

CreateTempFile creates a temporary file and returns its path Use fileNameExt to determine the filename along with the extension. EX: file.pdf

func CreateTextFile

func CreateTextFile(filePath, content string) error

CreateTextFile create a text fileUtil, not binary fileUtil

func CsvStringToMap

func CsvStringToMap(fileString string, delimiter rune, upperColumns bool) (r []map[string]string, err error)

CsvStringToMap Convert Csv stringUtil to Map

func CsvStringToStruct

func CsvStringToStruct(fileString string, delimiter rune, quoted bool, dest interface{}) (err error)

CsvStringToStruct converte um arquivo csv no formato de string para uma struct, essa struct passada deve ser uma lista

func DecodeISO88591

func DecodeISO88591(b string) string

DecodeSO8859_1 funcao para decodificar bytes que possuem acentos, retorna com acento corretamente

func DirectotyExists

func DirectotyExists(path string) bool

DirectotyExists check if directoty exists given a path

func Exists

func Exists(path string) bool

Exists ehck if the file exists given the path

func FileBase64ToFile

func FileBase64ToFile(b64 string, filename string) (err error)

FileBase64ToFile funcao para salvar uma string de um arquivo em base64 em um arquivo o disco e no caminho especificado no parametro `filename`

func FileBase64ToReader

func FileBase64ToReader(contentBase64 string) *bytes.Reader

FileBase64ToReader convert string in base64 to Reader interface

func FileToBase64

func FileToBase64(filepath string) (result string, err error)

FileToBase64 function to convert a local fileUtil into base64

func FileToString

func FileToString(filename string) string

FileToString convert text fileUtil to string

func FileUrlToBase64

func FileUrlToBase64(url string) (result string, err error)

FileUrlToBase64 faz o download de um arquivo dado uma url e retorna o mesmo no formato base64

func FileUrlToLocalfile

func FileUrlToLocalfile(url, localpath string) (err error)

FileUrlToLocalfile faz o download de um arquivo dado uma url e salva no caminho passado como parametro

func FileUrlToReader

func FileUrlToReader(url string) (result *bytes.Reader, err error)

FileUrlToReader faz o download de um arquivo dado uma url e retorna um objeto do tipo `bytes.Reader`

func GetBase64Content

func GetBase64Content(b64 string) string

GetBase64Content essa funcao remove os dados sobre o base64 da string, quando converte para base 64, ele pode retornar com fragmento dizendo o tipo de arquivo e isso nao é válido para criar um arquivo

func GetDir

func GetDir(path string) (dir string)

GetDir retorna o diretorio dado um caminho, ja retorna com o slash compativel com o sistema operacional

func GetFileExtensionFromBase64

func GetFileExtensionFromBase64(strBase64 string) (string, error)

getMineTypeFromReader get the Mine type from reader

func GetFileExtensionFromPath

func GetFileExtensionFromPath(path string) string

GetFileExtensionFromPath retorna a extensao do aruivo dado um determinado path

func GetFileListFromDirectory

func GetFileListFromDirectory(directoryPath string, recursively bool) ([]string, error)

GetFileListFromDirectory returns slice/list of the files within the path passed by parameter, specify if it will returns recursively or not

func GetFileNameWithExtensionFromPath

func GetFileNameWithExtensionFromPath(path string) string

GetFileNameWithExtensionFromPath retorna o nome do arquivo com a extensao dado um determinado path

func GetFileSizeFromBase64

func GetFileSizeFromBase64(fileBase64 string) int

GetFileSizeFromBase64 get the file size of the base64 string, return the int value what represents the size in KB

func GetMineTypeFromBase64

func GetMineTypeFromBase64(strBase64 string) string

getMineTypeFromReader get the file Mine type from string base64 format

func GetMineTypeFromReader

func GetMineTypeFromReader(reader *bytes.Reader) string

getMineTypeFromReader get the Mine type from reader

func GetTempPath

func GetTempPath(filename string) string

GetTempPath retorna um diretorio temporário junto com o nome do arquivo passado como parametro

func GetUniqueTempDir

func GetUniqueTempDir() string

GetUniqueTempDir retorna um diretorio temporário(com o path compatível com o OS) adicionado de uma string que o deixa único

func IsBase64

func IsBase64(b64 string) bool

IsBase64 verifica se uma string é base64 valida

func IsDirectory

func IsDirectory(path string) bool

IsDirectory check if the path is a directory or not

func RemoveLastDirectoryFromPath

func RemoveLastDirectoryFromPath(p string) string

RemoveLastDirectoryFromPath remove o ultimo diretorio de um caminho especificado no parametro

func RemoveXmlVersion

func RemoveXmlVersion(xmlString string) string

removeXmlVersion remove a string da versao do xml, pois quando gera esta vindo essa string

func StringToBase64

func StringToBase64(s string) string

StringToBase64 converte string em base64

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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