Giter Site home page Giter Site logo

Comments (7)

the8472 avatar the8472 commented on June 1, 2024

You need to seek the file back to the start after writing.

from flate2-rs.

deven96 avatar deven96 commented on June 1, 2024

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.

Byron avatar Byron commented on June 1, 2024

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.

deven96 avatar deven96 commented on June 1, 2024

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.

the8472 avatar the8472 commented on June 1, 2024

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.

deven96 avatar deven96 commented on June 1, 2024

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.

deven96 avatar deven96 commented on June 1, 2024

Although I can see that the Write implementation expects already compressed data

from flate2-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.