Example #1
0
func paths(w io.Writer, r io.Reader) error {
	return decode(r, func(codec *mux.Multicodec, v interface{}) error {
		p := mc.HeaderPath(codec.Last.Header())
		_, err := fmt.Fprintln(w, string(p))
		return err
	})
}
Example #2
0
func h2p(w io.Writer, r io.Reader) error {
	for {
		hdr, err := mc.ReadHeader(r)
		if err != nil {
			if err == io.EOF {
				return nil
			}
			return err
		}

		p := string(mc.HeaderPath(hdr))

		_, err = fmt.Fprintln(w, p)
		if err != nil {
			return err
		}
	}
}