Giter VIP home page Giter VIP logo

Comments (7)

kenkit avatar kenkit commented on May 20, 2024

I can see the feature is there, the problem is it does not detect the archive type.

 Folders count: 0
 Files count: 3
 Size: 13551341
 Packed size: 13376716

Archive items
 Item index: 0
  Name: J110F_twrp.img.tar
  Extension: tar
  Path: J110F_twrp.img.tar
  IsDir: 0
  Size: 9533440
  Packed size: 9359154

 Item index: 1
  Name: UPDATE-SuperSU-v2.46.zip
  Extension: zip
  Path: UPDATE-SuperSU-v2.46.zip
  IsDir: 0
  Size: 4017098
  Packed size: 4017098

 Item index: 2
  Name: Password.txt
  Extension: txt
  Path: Password.txt
  IsDir: 0
  Size: 803
  Packed size: 464
Cannot detect the format of the file <---After listing the archive I extract to buffer

from bit7z.

kenkit avatar kenkit commented on May 20, 2024

It is not working, it expects I input the path to the archive, not the path to the file.
So I think this is a valid feature request.

from bit7z.

rikyoz avatar rikyoz commented on May 20, 2024

Describe the solution you'd like
I can see that we can extract specific files by matching paths. However I'd like to extract a specific file to buffer.
I'm not sure how long it will take to implement this since my app needs this feature to extract webpages into a buffer.

Additional context (optional)
Something like this

extractor.extract( L"path/to/another/file.txt", buffer );

Unfortunately, at the moment extracting a single file to a buffer by matching its name/path is not available: extraction by matching is supported only when the output target is the filesystem.

Implementing such functionality should not take much time, however it would potentially introduce redundancies in the code and avoiding them would take some time for reasoning; moreover, it would introduce also inconsistencies in the API which must be addressed!

It is not working, it expects I input the path to the archive, not the path to the file.
So I think this is a valid feature request.

Anyway, with the current version of bit7z there is a workaround: you can use the BitExtractor::extract(...) method, to which you can pass, as third parameter, the index (in the archive) of the file you need (you can get it using BitArchiveInfo if you don't already know it a priori).
For example:

const auto archive_name = L"archive.7z";
const auto file_path = L"path/to/another/file.txt"; // The path of the file you want to extract inside the archive
vector< byte_t > buffer;
BitArchiveInfo arc{ lib, archive_name, BitFormat::SevenZip };
auto arc_items = arc.items();
for ( auto& item : arc_items ) {
    if ( item.path() == file_path ) {
        // We have found the file we want to extract!
        BitExtractor extractor{ lib, BitFormat::SevenZip };
        extractor.extract( archive_name, buffer, item.index() );
        break;
    }
}

from bit7z.

kenkit avatar kenkit commented on May 20, 2024

Thanks for taking time to respond and also for the info. I will try this method instead.

from bit7z.

rikyoz avatar rikyoz commented on May 20, 2024

You're welcome!

from bit7z.

uq1 avatar uq1 commented on May 20, 2024

Could we possibly get the ability to use pre-allocated C style buffers (eg: void *buf)?

Trying to use the library to load game files, but allocation of a new buffer and then copying is forcing me to double the ram usage of large files (700mb) on a 32 bit process, and running out of memory.

from bit7z.

rikyoz avatar rikyoz commented on May 20, 2024

Could we possibly get the ability to use pre-allocated C style buffers (eg: void *buf)?

Trying to use the library to load game files, but allocation of a new buffer and then copying is forcing me to double the ram usage of large files (700mb) on a 32 bit process, and running out of memory.

Supporting C style buffers would require really many changes in the internal code of bit7z, which extensively uses std::vector.
Anyway, for the next version I will evaluate how to support it, but it won't be anytime soon (due to other commitments).

from bit7z.

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.