Comments (7)
You need to seek the file back to the start after writing.
from flate2-rs.
You're correct @the8472
Seek
isn't implemented for GzDecoder
and I tried Write::flush
maybe it would reset the cursor but to no avail
from flate2-rs.
Can you try to open the decoded file after it was flushed, from disk? I have a feeling this is an issue related to the way GzDecoder
works, and I'd be a bit surprised if one can use it like it's done here.
My hypothesis is that the decoded data is written to disk, but that it's impossible to do so through GzDecoder
.
from flate2-rs.
The .csv.gz
is actually on disk correctly i.e I can manually unzip and retrieve the original file after the first copy
(even without flush). However as I can't reset the cursor via GzDecoder
there's no way to tell it to return to start before starting the read
from flate2-rs.
You can access the inner via get_mut
. Or you can operate on the File
directly and only wrap it in the encoder once it's written. It shouldn't be necessary to write through the encoder.
from flate2-rs.
That's the implementation I eventually stuck with, writing to the file first and then operating after. Would it be possible however to do
use std::io::Seek
/// where there is an `impl <S: Seek> for GzDecoder<S>`
zip_buffer.rewind()?;
With usecase being that I want to [ write (compress to gz) -> read (uncompressed) ]
from flate2-rs.
Although I can see that the Write
implementation expects already compressed data
from flate2-rs.
Related Issues (20)
- `GzDecoder` eager reading in the constructor blocks IO HOT 9
- Error on compiling flate2 on rust 1.57.0 HOT 2
- flate2::bufread::GzDecoder doesn't impl BufRead? HOT 3
- unsafe review: Potential (not actual) dangling pointers after inflate/deflate HOT 2
- total_in(&self) / total_out(&self) implementation for GzDecoder / GzEncoder / MultiGzDecoder HOT 2
- Implement BufRead/Write for en/decoders alongside Read/Write
- rapidgzip
- Zlib succes while miniz_oxide fails HOT 5
- Testing validity of the data without the actual decompression
- Tree borrows violation occurs when using zlib backend HOT 5
- Some compressed files can only read a portion of the lines using GzDecoder. HOT 3
- question: Slowdown after upgrading from 1.0.26 to 1.0.28 HOT 8
- Using MultiGzDecoder for file with garbage after gzip data HOT 3
- Decoding a zip file returns the Error "corrupt deflate stream" HOT 2
- why GzDecoder can't read stream correct HOT 1
- Continue reading a stream after ZlibDecoder streams finishes HOT 8
- docs.rs failed to build flate2-1.0.29 HOT 1
- Add ability to set window_bits when using rust backend?
- unknown return code: -4 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flate2-rs.