func (f *Fs) DownloadRemoteFile(url string, name string) error {
	// Get the data
	cli := &http.Client{}
	ctx := context.Background()
	req, _ := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)

	resp, err := cli.Do(req)
	if err != nil {
		return errors.Wrap(err, "remote file request")
	}
	defer resp.Body.Close()

	// Create the file
	out, err := f.AferoFs.Create(name)
	if err != nil {
		return errors.Wrap(err, "create file")
	}
	defer out.Close()

	// Write the body to file
	_, err = io.Copy(out, resp.Body)

	return errors.Wrap(err, "copying file content")
}
// DownloadRemoteFile downloads file from the internet onto disk.
DownloadRemoteFile downloads file from the internet onto disk.
// DownloadRemoteFile downloads file from the internet onto disk .
func (f *Fs) DownloadRemoteFile(url string, name string) error {
	cli := &http.Client{}
	ctx := context.Background()
	req, _ := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
	resp, err := cli.Do(req)
	if err != nil {
		return errors.Wrap(err, "remote file request")
	}
	defer resp.Body.Close()
	out, err := f.AferoFs.Create(name)
	if err != nil {
		return errors.Wrap(err, "create file")
	}
	defer out.Close()
	_, err = io.Copy(out, resp.Body)
	return errors.Wrap(err, "copying file content")
}
func ( f * Fs ) DownloadRemoteFile ( url string , name string ) error { cli := & http . Client { } ctx := context . Background ( ) req , _ := http . NewRequestWithContext ( ctx , http . MethodGet , url , nil ) resp , err := cli . Do ( req ) if err != nil { return errors . Wrap ( err , " " ) } defer resp . Body . Close ( ) out , err := f . AferoFs . Create ( name ) if err != nil { return errors . Wrap ( err , " " ) } defer out . Close ( ) _ , err = io . Copy ( out , resp . Body ) return errors . Wrap ( err , " " ) }
DownloadRemoteFile downloads file from the internet onto disk.
DownloadRemoteFile downloads file from the internet onto disk .
// Get the data // Create the file // Write the body to file