code: func NewCompressedReader(rs io.ReadSeeker) (io.ReadCloser, error) {
  
  	var (
  		dr  io.ReadCloser
  		err error
  	)
  
  	_, err = rs.Seek(0, 0)
  	if err != nil {
  		return nil, err
  	}
  
  	ftype, err := DetectFileType(rs)
  	if err != nil {
  		return nil, err
  	}
  
  	_, err = rs.Seek(0, 0)
  	if err != nil {
  		return nil, err
  	}
  
  	switch ftype {
  	case TypeGzip:
  		dr, err = gzip.NewReader(rs)
  		if err != nil {
  			return nil, err
  		}
  	case TypeBzip2:
  		dr = ioutil.NopCloser(bzip2.NewReader(rs))
  	case TypeXz:
  		dr, err = NewXzReader(rs)
  		if err != nil {
  			return nil, err
  		}
  	case TypeTar:
  		dr = ioutil.NopCloser(rs)
  	case TypeUnknown:
  		return nil, errors.New("error: unknown image filetype")
  	default:
  		return nil, errors.New("no type returned from DetectFileType?")
  	}
  	return dr, nil
  }
docs: // NewCompressedReader creates a new io.ReaderCloser from the given ACI image.
  // It is the caller's responsibility to call Close on the Reader when done.