All reads now skip stream if in memory.
This commit is contained in:
1 parent
a70635d2f6
commit
342adb627d
4 files changed
+52
-51
No files matched your search
@@ -14,6 +14,8 @@ package gzip
|
||||
|
||||
import "core:bytes"
|
||||
import "core:os"
|
||||
import "core:compress"
|
||||
import "core:fmt"
|
||||
|
||||
// Small GZIP file with fextra, fname and fcomment present.
|
||||
@private
|
||||
@@ -48,6 +50,8 @@ main :: proc() {
|
||||
stdout("Displaying test vector: ");
|
||||
stdout(bytes.buffer_to_string(&buf));
|
||||
stdout("\n");
|
||||
} else {
|
||||
fmt.printf("gzip.load returned %v\n", err);
|
||||
}
|
||||
bytes.buffer_destroy(&buf);
|
||||
os.exit(0);
|
||||
@@ -61,7 +65,10 @@ main :: proc() {
|
||||
if file == "-" {
|
||||
// Read from stdin
|
||||
s := os.stream_from_handle(os.stdin);
|
||||
err = load(s, &buf);
|
||||
ctx := &compress.Context{
|
||||
input = s,
|
||||
};
|
||||
err = load(ctx, &buf);
|
||||
} else {
|
||||
err = load(file, &buf);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user