MCPcopy Index your code
hub / github.com/tdewolff/minify / Reader

Method Reader

minify.go:251–261  ·  view source on GitHub ↗

Reader wraps a Reader interface and minifies the stream. Errors from the minifier are returned by the reader.

(mediatype string, r io.Reader)

Source from the content-addressed store, hash-verified

249// Reader wraps a Reader interface and minifies the stream.
250// Errors from the minifier are returned by the reader.
251func (m *M) Reader(mediatype string, r io.Reader) io.Reader {
252 pr, pw := io.Pipe()
253 go func() {
254 if err := m.Minify(mediatype, pw, r); err != nil {
255 pw.CloseWithError(err)
256 } else {
257 pw.Close()
258 }
259 }()
260 return pr
261}
262
263// writer makes sure that errors from the minifier are passed down through Close (can be blocking).
264type writer struct {

Callers 3

TestReaderFunction · 0.80
ExampleM_ReaderFunction · 0.80
ExampleMinify_readerFunction · 0.80

Calls 2

MinifyMethod · 0.95
CloseMethod · 0.45

Tested by 3

TestReaderFunction · 0.64
ExampleM_ReaderFunction · 0.64
ExampleMinify_readerFunction · 0.64