stream

package
v0.0.0-...-23ff3f9 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package stream work with io.Reader

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Stream

type Stream struct {
	io.Reader
	// contains filtered or unexported fields
}

Stream contains information about a loaded image.

func EncodeImage

func EncodeImage(img image.Image) (Stream, error)

EncodeImage encodes an image into a stream.

func NewStream

func NewStream(s io.Reader) (Stream, error)

NewStream creates a new stream struct.

func (*Stream) Bytes

func (st *Stream) Bytes() []byte

Bytes returns the stream's bytes.

func (*Stream) DecodeImage

func (st *Stream) DecodeImage() (image.Image, error)

DecodeImage decodes the byte stream and returns an image.

func (*Stream) FileExt

func (st *Stream) FileExt() string

FileExt returns the file extension of the image.

func (*Stream) IsGif

func (st *Stream) IsGif() bool

IsGif returns true if the loaded image is a gif.

func (*Stream) IsJpg

func (st *Stream) IsJpg() bool

IsJpg returns true if the loaded image is a Jpeg.

func (*Stream) IsPng

func (st *Stream) IsPng() bool

IsPng returns true if the loaded image is a Png.

func (*Stream) Read

func (st *Stream) Read(b []byte) (n int, err error)

Read implements the io.Reader interface for the Stream.

Jump to

Keyboard shortcuts

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