// zipCopy copies a file from a FS to a zip using the information in the
// provided FileHeader.
zipCopy copies a file from a FS to a zip using the information in the
provided FileHeader.
// zipCopy copies a file from a FS to a zip using the information in the // provided FileHeader .
func zipCopyFS(z *zip.Writer, f *zip.FileHeader, fs fs.FS) error {
	rc, err := fs.Open(f.Name)
	if err != nil {
		return err
	}
	defer rc.Close()
	w, err := z.CreateHeader(&zip.FileHeader{
		Name:          f.Name,
		Comment:       f.Comment,
		Method:        f.Method,
		Modified:      f.Modified,
		ModifiedTime:  f.ModifiedTime,
		ModifiedDate:  f.ModifiedDate,
		Extra:         f.Extra,
		ExternalAttrs: f.ExternalAttrs,
	})
	if err != nil {
		return err
	}
	_, err = io.Copy(w, rc)
	return err
}
func zipCopyFS ( z * zip . Writer , f * zip . FileHeader , fs fs . FS ) error { rc , err := fs . Open ( f . Name ) if err != nil { return err } defer rc . Close ( ) w , err := z . CreateHeader ( & zip . FileHeader { Name : f . Name , Comment : f . Comment , Method : f . Method , Modified : f . Modified , ModifiedTime : f . ModifiedTime , ModifiedDate : f . ModifiedDate , Extra : f . Extra , ExternalAttrs : f . ExternalAttrs , } ) if err != nil { return err } _ , err = io . Copy ( w , rc ) return err }
zipCopy copies a file from a FS to a zip using the information in the
provided FileHeader.
zipCopy copies a file from a FS to a zip using the information in the provided FileHeader .