func untarHandler(tarArchive io.Reader, dest string, options *archive.TarOptions, decompress bool) error {

	if tarArchive == nil {
		return fmt.Errorf("Empty archive")
	}
	if options == nil {
		options = &archive.TarOptions{}
	}
	if options.ExcludePatterns == nil {
		options.ExcludePatterns = []string{}
	}

	dest = filepath.Clean(dest)
	if _, err := os.Stat(dest); os.IsNotExist(err) {
		if err := system.MkdirAll(dest, 0777); err != nil {
			return err
		}
	}

	r := ioutil.NopCloser(tarArchive)
	if decompress {
		decompressedArchive, err := archive.DecompressStream(tarArchive)
		if err != nil {
			return err
		}
		defer decompressedArchive.Close()
		r = decompressedArchive
	}

	return invokeUnpack(r, dest, options)
}
// Handler for teasing out the automatic decompression
Handler for teasing out the automatic decompression
// Handler for teasing out the automatic decompression
func untarHandler(tarArchive io.Reader, dest string, options *archive.TarOptions, decompress bool) error {
	if tarArchive == nil {
		return fmt.Errorf("Empty archive")
	}
	if options == nil {
		options = &archive.TarOptions{}
	}
	if options.ExcludePatterns == nil {
		options.ExcludePatterns = []string{}
	}
	dest = filepath.Clean(dest)
	if _, err := os.Stat(dest); os.IsNotExist(err) {
		if err := system.MkdirAll(dest, 0777); err != nil {
			return err
		}
	}
	r := ioutil.NopCloser(tarArchive)
	if decompress {
		decompressedArchive, err := archive.DecompressStream(tarArchive)
		if err != nil {
			return err
		}
		defer decompressedArchive.Close()
		r = decompressedArchive
	}
	return invokeUnpack(r, dest, options)
}
func untarHandler ( tarArchive io . Reader , dest string , options * archive . TarOptions , decompress bool ) error { if tarArchive == nil { return fmt . Errorf ( " " ) } if options == nil { options = & archive . TarOptions { } } if options . ExcludePatterns == nil { options . ExcludePatterns = [ ] string { } } dest = filepath . Clean ( dest ) if _ , err := os . Stat ( dest ) ; os . IsNotExist ( err ) { if err := system . MkdirAll ( dest , 0777 ) ; err != nil { return err } } r := ioutil . NopCloser ( tarArchive ) if decompress { decompressedArchive , err := archive . DecompressStream ( tarArchive ) if err != nil { return err } defer decompressedArchive . Close ( ) r = decompressedArchive } return invokeUnpack ( r , dest , options ) }
Handler for teasing out the automatic decompression
Handler for teasing out the automatic decompression