grahjenk has asked for the wisdom of the Perl Monks concerning the following question:
Is there a way of downloading into a filehandle or pipe so that I don't have to download the entire large file?use File::Fetch; use IO::Uncompress::AnyUncompress qw(anyuncompress $AnyUncompressError +); # Download a very large zipfile my $ff=File::Fetch->new(uri => "https://tranco-list.eu/top-1m.csv.zip" +); my $scalar; my $where=$ff->fetch( to => \$scalar ) or die $ff->error; # Print the first 10 lines my $z=new IO::Uncompress::AnyUncompress(\$scalar); for (my $i=0;$i<10;$i++) { my $line=$z->getline(); $line=~s/\r|\n//g; print $line,"\n" }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Fetch URL Contents to File Handle
by haukex (Archbishop) on Jun 09, 2020 at 08:19 UTC | |
by marto (Cardinal) on Jun 09, 2020 at 08:32 UTC | |
|
Re: Fetch URL Contents to File Handle
by haukex (Archbishop) on Jun 09, 2020 at 07:28 UTC | |
by pmqs (Friar) on Jun 10, 2020 at 12:31 UTC | |
by haukex (Archbishop) on Jun 10, 2020 at 20:12 UTC | |
|
Re: Fetch URL Contents to File Handle
by perlfan (Parson) on Jun 09, 2020 at 03:35 UTC | |
by soonix (Chancellor) on Jun 09, 2020 at 08:00 UTC | |
by Anonymous Monk on Jun 09, 2020 at 08:30 UTC |