ioutils

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MimeTextPlain is the MIME type for plain text
	MimeTextPlain string = "text/plain"
	// MimeTextHTML is the MIME type for HTML
	MimeTextHTML string = "text/html"
	// MimeTextCSS is the MIME type for CSS
	MimeTextCSS string = "text/css"
	// MimeTextCSV is the MIME type for CSV
	MimeTextCSV string = "text/csv"
	// MimeTextCalendar is the MIME type for calendar data
	MimeTextCalendar string = "text/calendar"
	// Markdown is the MIME type for Markdown
	MimeMarkDown string = "text/markdown"
	// MimeTextYAML is the MIME type for YAML
	MimeTextYAML string = "text/yaml"
	// MimeTextXML is the MIME type for XML
	MimeTextXML string = "text/xml"
	// MimeApplicationXML is the MIME type for XML
	MimeApplicationXML string = "application/xml"
	// MimeApplicationJSON is the MIME type for JSON
	MimeApplicationJSON string = "application/json"
	// MimeApplicationOctetStream is the MIME type for binary data
	MimeApplicationOctetStream string = "application/octet-stream"
	// MimeImagePNG is the MIME type for PNG images
	MimeImagePNG string = "image/png"
	// MimeImageJPEG is the MIME type for JPEG images
	MimeImageJPEG string = "image/jpeg"
	// MimeImageGIF is the MIME type for GIF images
	MimeImageGIF string = "image/gif"
	// MimeImageSVG is the MIME type for SVG images
	MimeImageSVG string = "image/svg+xml"
	// MimeAudioMPEG is the MIME type for MP3 audio
	MimeAudioMPEG string = "audio/mpeg"
	// MimeAudioWAV is the MIME type for WAV audio
	MimeAudioWAV string = "audio/wav"
	// MimeAudioFLAC is the MIME type for FLAC audio
	MimeAudioFLAC string = "audio/flac"
	// MimeAudioAAC is the MIME type for AAC audio
	MimeAudioAAC string = "audio/aac"
	// MimeAudioMIDI is the MIME type for MIDI audio
	MimeAudioMIDI string = "audio/midi"
	// MimeAudioWebM is the MIME type for WebM audio
	MimeAudioWebM string = "audio/webm"
	// MimeAudioOpus is the MIME type for Opus audio
	MimeAudioOpus string = "audio/opus"
	// MimeAudioWMA is the MIME type for WMA audio
	MimeAudioWMA string = "audio/x-ms-wma"
	// MimeAudioAIFF is the MIME type for AIFF audio
	MimeAudioAIFF string = "audio/x-aiff"
	// MimeAudioAU is the MIME type for AU audio
	MimeAudioAU string = "audio/basic"
	// MimeAudioAMR is the MIME type for AMR audio
	MimeAudioAMR string = "audio/amr"
	// MimeAudioAMRWB is the MIME type for AMR-WB audio
	MimeAudioAMRWB string = "audio/amr-wb"
	// MimeAudioMP3 is the MIME type for MP3 audio
	MimeAudioMP3 string = "audio/mp3"
	// MimeAudioOGG is the MIME type for OGG audio
	MimeAudioOGG string = "audio/ogg"
	// MimeVideoMPEG is the MIME type for MPEG video
	MimeVideoMPEG string = "video/mpeg"
	// MimeVideoMP4 is the MIME type for MP4 video
	MimeVideoMP4 string = "video/mp4"
	// MimeVideoOGG is the MIME type for OGG video
	MimeVideoOGG string = "video/ogg"
	// MimeVideoQuickTime is the MIME type for QuickTime video
	MimeVideoQuickTime string = "video/quicktime"
	// MimeVideoWebM is the MIME type for WebM video
	MimeVideoWebM string = "video/webm"
	// MimeVideoWMV is the MIME type for WMV video
	MimeVideoWMV string = "video/x-ms-wmv"
	// MimeVideoAVI is the MIME type for AVI video
	MimeVideoAVI string = "video/x-msvideo"
	// MimeVideoFLV is the MIME type for FLV video
	MimeVideoFLV string = "video/x-flv"
	// MimeVideoH264 is the MIME type for H.264 video
	MimeVideoH264 string = "video/h264"
	// MimeVideoH265 is the MIME type for H.265 video
	MimeVideoH265 string = "video/h265"
	// MimeVideoVP8 is the MIME type for VP8 video
	MimeVideoVP8 string = "video/vp8"
	// MimeVideoVP9 is the MIME type for VP9 video
	MimeVideoVP9 string = "video/vp9"
	// MimeVideoAV1 is the MIME type for AV1 video
	MimeVideoAV1 string = "video/av1"
	// MimeVideoMJPEG is the MIME type for MJPEG video
	MimeVideoMJPEG string = "video/mjpeg"
	// MimeVideoMKV is the MIME type for MKV video
	MimeVideoMKV string = "video/x-matroska"

	// MimeVideoMP4V is the MIME type for MP4 video
	// MimeApplicationPDF is the MIME type for PDF documents
	MimeApplicationPDF string = "application/pdf"
	// MimeApplicationZIP is the MIME type for ZIP archives
	MimeApplicationZIP string = "application/zip"
	// MimeApplicationGZIP is the MIME type for GZIP archives
	MimeApplicationGZIP string = "application/gzip"
	// MimeApplicationTAR is the MIME type for TAR archives
	MimeApplicationTAR string = "application/tar"
	// MimeApplicationXZ is the MIME type for XZ archives
	MimeApplicationXZ string = "application/x-xz"
	// MimeApplicationBZIP2 is the MIME type for BZIP2 archives
	MimeApplicationBZIP2 string = "application/x-bzip2"
	// MimeApplicationRar is the MIME type for RAR archives
	MimeApplicationRar string = "application/vnd.rar"
	// MimeApplication7z is the MIME type for 7z archives
	MimeApplication7z string = "application/x-7z-compressed"
	// MimeApplicationMSWord is the MIME type for Microsoft Word documents
	MimeApplicationMSWord string = "application/msword"
	//MimeApplicationMSWordOpenXML is the MIME type for Microsoft Word Open XML documents
	MimeApplicationMSWordOpenXML string = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
	// MimeApplicationMSPowerpoint is the MIME type for Microsoft PowerPoint presentations
	MimeApplicationMSPowerpoint string = "application/vnd.ms-powerpoint"
	//MimeApplicationMSPowerpointOpenXML is the MIME type for Microsoft PowerPoint Open XML presentations
	MimeApplicationMSPowerpointOpenXML string = "application/vnd.openxmlformats-officedocument.presentationml.presentation"
	// MimeApplicationMSExcel is the MIME type for Microsoft Excel spreadsheets
	MimeApplicationMSExcel string = "application/vnd.ms-excel"
	//MimeApplicationMsExcelOpenXML is the MIME type for Microsoft Excel Open XML spreadsheets
	MimeApplicationMsExcelOpenXML string = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
View Source
const (
	SHA256 = "SHA256"
)

Variables

View Source
var CloserFunc = func(closer io.Closer) {
	_ = closer.Close()
}

Functions

func GetExtsFromMime added in v0.0.15

func GetExtsFromMime(mime string) []string

func GetMimeFromExt added in v0.0.15

func GetMimeFromExt(ext string) string

GetMimeFromExt returns the MIME type for the given file extension

Types

type ChkSumCalc added in v0.0.15

type ChkSumCalc interface {
	// Calculate calculates the checksum of the message
	Calculate(content string) (string, error)
	// Verify verifies the checksum of the message
	Verify(content, sum string) (bool, error)
	//CalculateFile calculates the checksum of a file
	CalculateFile(file string) (string, error)
	//VerifyFile verifies the checksum of a file
	VerifyFile(file, sum string) (bool, error)
	//CalculateFor calculates the checksum of the reader
	CalculateFor(reader io.Reader) (string, error)
	// VerifyFor verifies the checksum of the reader
	VerifyFor(reader io.Reader, sum string) (bool, error)
	//Type returns the type of the checksum
	Type() string
}

ChkSumCalc interface is used to calculate the checksum of a text or file

func NewChkSumCalc added in v0.0.15

func NewChkSumCalc(t string) ChkSumCalc

NewChkSumCalc creates a new checksum

type Sha256Checksum added in v0.0.15

type Sha256Checksum struct {
}

Sha256Checksum is a checksum that uses the SHA256 algorithm

func (*Sha256Checksum) Calculate added in v0.0.15

func (s *Sha256Checksum) Calculate(content string) (chksum string, err error)

Calculate calculates the checksum of the message

func (*Sha256Checksum) CalculateFile added in v0.0.15

func (s *Sha256Checksum) CalculateFile(file string) (chksum string, err error)

CalculateFile calculates the checksum of a file

func (*Sha256Checksum) CalculateFor added in v0.0.15

func (s *Sha256Checksum) CalculateFor(reader io.Reader) (chksum string, err error)

CalculateFor calculates the checksum of the reader

func (*Sha256Checksum) Type added in v0.0.15

func (s *Sha256Checksum) Type() string

Type returns the type of the checksum

func (*Sha256Checksum) Verify added in v0.0.15

func (s *Sha256Checksum) Verify(content, sum string) (b bool, err error)

Verify verifies the checksum of the message

func (*Sha256Checksum) VerifyFile added in v0.0.15

func (s *Sha256Checksum) VerifyFile(file, sum string) (b bool, err error)

VerifyFile verifies the checksum of a file

func (*Sha256Checksum) VerifyFor added in v0.0.15

func (s *Sha256Checksum) VerifyFor(reader io.Reader, sum string) (b bool, err error)

VerifyFor verifies the checksum of the reader

Jump to

Keyboard shortcuts

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