From f72c4887f028ec36ece81baafba606cdd4add1ef Mon Sep 17 00:00:00 2001 From: Doug Watson Date: Tue, 7 Jun 2022 21:52:33 -0500 Subject: [PATCH 1/2] added function to fetch the full multipart message so we can read the headers out later --- mjpeg.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mjpeg.go b/mjpeg.go index c60509f..9ed5dc3 100644 --- a/mjpeg.go +++ b/mjpeg.go @@ -60,6 +60,15 @@ func (d *Decoder) Decode() (image.Image, error) { return jpeg.Decode(p) } +//Don't decode image, just return the multipart data structure +func (d *Decoder) Part() (*multipart.Part, error) { + p, err := d.r.NextPart() + if err != nil { + return nil, err + } + return p, nil +} + // DecodeRaw do decoding raw bytes func (d *Decoder) DecodeRaw() ([]byte, error) { p, err := d.r.NextPart() From efa068603b911aca2fb3f2912afeb58b6125e5da Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 8 Jun 2022 17:14:55 +0900 Subject: [PATCH 2/2] Update mjpeg.go --- mjpeg.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mjpeg.go b/mjpeg.go index 9ed5dc3..cad3d43 100644 --- a/mjpeg.go +++ b/mjpeg.go @@ -60,7 +60,7 @@ func (d *Decoder) Decode() (image.Image, error) { return jpeg.Decode(p) } -//Don't decode image, just return the multipart data structure +// Part just return the multipart data structure func (d *Decoder) Part() (*multipart.Part, error) { p, err := d.r.NextPart() if err != nil {