Giter Club home page Giter Club logo

Comments (9)

wapmorgan avatar wapmorgan commented on July 23, 2024 1

I've added getFileResource() in 0.2 branch that will be released soon. Now it supports native streams only for zip/rar and one-file archives, all other types simulate streaming.

from unifiedarchive.

wapmorgan avatar wapmorgan commented on July 23, 2024

There is no need to open access to underlying resources in API, so you can extract all files and then open them as you want.

from unifiedarchive.

flip111 avatar flip111 commented on July 23, 2024

why do extra work to extract all files when just one is needed ?

from unifiedarchive.

wapmorgan avatar wapmorgan commented on July 23, 2024

Because splitting text files into array of lines is just one case, and create another method in API to access file stream is overhead for api. I'll think about this, but for now this opportunity is not necessary.
If server configuration allow you read all file in memory, then why use streams? Just for fgets()?
If file is too big, just unpack it on storage and work like with normal file.

from unifiedarchive.

flip111 avatar flip111 commented on July 23, 2024

I was just suggesting this method to avoid overhead. What you propose does this:

  1. read archive from disk
  2. write unpacked archive to RAM (this is part of unpacking)
  3. write file to disk
  4. open file pointer to file (in case of using streams)
  5. write split lines to RAM (php strings)
  6. remove file from disk

If you can use streams then you can go directly from RAM to RAM (step 2 to step 5) and you can skip step 3 and step 6. This should be a lot faster (also depending on what kind of disk you use).

The getResource method won't be called in other use cases, so the overhead you mention is only when parsing the PHP file to generate opcodes. If you have opcache on then this overhead is gone. You still need a few bytes in RAM to register a new method (to have the opcodes loaded).

from unifiedarchive.

wapmorgan avatar wapmorgan commented on July 23, 2024

If other people agree that this useful method, I will add it.

from unifiedarchive.

wapmorgan avatar wapmorgan commented on July 23, 2024

So, anybody else thinks it's a good addition?

from unifiedarchive.

flip111 avatar flip111 commented on July 23, 2024

Please don't implement it just for me, it's not worth to do it for 1 person.

from unifiedarchive.

wapmorgan avatar wapmorgan commented on July 23, 2024

Ok, may be in future I will rethink this, but now it's closed.

from unifiedarchive.

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.