Change Text, Bytes to FromText, FromBytes

This commit is contained in:
Sasha Koshka 2024-07-19 15:26:03 -04:00
parent f6556aa57f
commit 87494c014a

View File

@ -74,9 +74,9 @@ func (mime Mime) String () string {
return out return out
} }
// Text returns plain text Data given a string. // FromText returns plain text Data given a string.
func Text (text string) Data { func FromText (text string) Data {
return Bytes(MimePlain(), []byte(text)) return FromBytes(MimePlain(), []byte(text))
} }
type byteReadCloser struct { *bytes.Reader } type byteReadCloser struct { *bytes.Reader }
@ -87,8 +87,8 @@ type bytesData struct {
buffer []byte buffer []byte
} }
// Bytes constructs a Data given a buffer and a mime type. // FromBytes constructs a Data given a buffer and a mime type.
func Bytes (mime Mime, buffer []byte) Data { func FromBytes (mime Mime, buffer []byte) Data {
return bytesData { return bytesData {
mime: mime, mime: mime,
buffer: buffer, buffer: buffer,