File tree 1 file changed +6
-8
lines changed
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -724,14 +724,12 @@ pub const File = struct {
724
724
725
725
try in_file .reader ().skipBytes (args .in_offset , .{ .buf_size = 4096 });
726
726
727
- var buffer : [4096 ]u8 = undefined ;
728
- const in_len = args .in_len orelse math .maxInt (u64 );
729
- var index : usize = 0 ;
730
- while (index < in_len ) {
731
- const ask = math .min (buffer .len , in_len - index );
732
- const amt = try in_file .read (buffer [0.. ask ]);
733
- if (amt == 0 ) break ;
734
- index += try self .write (buffer [0.. amt ]);
727
+ var fifo = std .fifo .LinearFifo (u8 , .{ .Static = 4096 }).init ();
728
+ if (args .in_len ) | len | {
729
+ var stream = std .io .earlyEOFReader (in_file .reader (), len );
730
+ try fifo .pump (stream .reader (), self .writer ());
731
+ } else {
732
+ try fifo .pump (in_file .reader (), self .writer ());
735
733
}
736
734
737
735
try self .writevAll (trailers );
You can’t perform that action at this time.
0 commit comments