code: func DetectArchiveReader(input io.ReadCloser) (rc io.ReadCloser, isArchive bool, err error) {
  	buf := bufio.NewReader(input)
  
  	magic, err := buf.Peek(archiveHeaderSize * 2)
  	if err != nil && err != io.EOF {
  		return nil, false, errors.Errorf("failed to peek context header from STDIN: %v", err)
  	}
  
  	return ioutils.NewReadCloserWrapper(buf, func() error { return input.Close() }), IsArchive(magic), nil
  }
docs: // DetectArchiveReader detects whether the input stream is an archive or a
  // Dockerfile and returns a buffered version of input, safe to consume in lieu
  // of input. If an archive is detected, isArchive is set to true, and to false
  // otherwise, in which case it is safe to assume input represents the contents
  // of a Dockerfile.