mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 14:31:20 +03:00
Support compression on output stream
This commit is contained in:
parent
42f5bb6182
commit
83e8f377ad
@ -34,6 +34,8 @@ use strict;
|
|||||||
use Getopt::Long ();
|
use Getopt::Long ();
|
||||||
use Fcntl qw( O_CREAT O_EXCL O_WRONLY O_APPEND O_RDONLY O_WRONLY );
|
use Fcntl qw( O_CREAT O_EXCL O_WRONLY O_APPEND O_RDONLY O_WRONLY );
|
||||||
|
|
||||||
|
use IO::Compress::Gzip;
|
||||||
|
|
||||||
use constant GETOPT_OPTS => qw( auto_abbrev no_getopt_compat bundling );
|
use constant GETOPT_OPTS => qw( auto_abbrev no_getopt_compat bundling );
|
||||||
use constant GETOPT_SPEC =>
|
use constant GETOPT_SPEC =>
|
||||||
qw( output|o=s
|
qw( output|o=s
|
||||||
@ -43,6 +45,7 @@ use constant GETOPT_SPEC =>
|
|||||||
plat|platform|p=s
|
plat|platform|p=s
|
||||||
format|fmt|f=s
|
format|fmt|f=s
|
||||||
warning|W=s
|
warning|W=s
|
||||||
|
gzip|z
|
||||||
help|h|? );
|
help|h|? );
|
||||||
|
|
||||||
# default option values:
|
# default option values:
|
||||||
@ -214,7 +217,7 @@ sub input_stream ()
|
|||||||
return \*STDIN;
|
return \*STDIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub output_stream ()
|
sub underlying_output_stream ()
|
||||||
{
|
{
|
||||||
if( $opt{output} )
|
if( $opt{output} )
|
||||||
{
|
{
|
||||||
@ -229,6 +232,18 @@ sub output_stream ()
|
|||||||
return \*STDOUT;
|
return \*STDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub output_stream ()
|
||||||
|
{
|
||||||
|
my $ofh = underlying_output_stream();
|
||||||
|
|
||||||
|
if( $opt{gzip} )
|
||||||
|
{
|
||||||
|
$ofh = new IO::Compress::Gzip( $ofh, AutoClose => 1, -Level => 9 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $ofh;
|
||||||
|
}
|
||||||
|
|
||||||
sub formatter ()
|
sub formatter ()
|
||||||
{
|
{
|
||||||
my $name = $opt{format};
|
my $name = $opt{format};
|
||||||
|
Loading…
Reference in New Issue
Block a user