Comments (9)
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.
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.
why do extra work to extract all files when just one is needed ?
from unifiedarchive.
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.
I was just suggesting this method to avoid overhead. What you propose does this:
- read archive from disk
- write unpacked archive to RAM (this is part of unpacking)
- write file to disk
- open file pointer to file (in case of using streams)
- write split lines to RAM (php strings)
- 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.
If other people agree that this useful method, I will add it.
from unifiedarchive.
So, anybody else thinks it's a good addition?
from unifiedarchive.
Please don't implement it just for me, it's not worth to do it for 1 person.
from unifiedarchive.
Ok, may be in future I will rethink this, but now it's closed.
from unifiedarchive.
Related Issues (20)
- Rar: getArchiveInformation : skip Directories HOT 3
- Some of used packages are abandoned, consider to use something instead HOT 1
- Returns null on rar archives HOT 3
- Work with 7zip archive format HOT 1
- Get a list of directories in the archive HOT 3
- Roadmap to 1.2.0
- unnecessary file UnifiedArchive.tar.xz HOT 1
- Unable to extract a ".tar.xz" archive HOT 3
- Creating a tar.gz file also creates a .tar file HOT 5
- Compress no longer available HOT 1
- Extract RAR file error HOT 3
- Extract tar.gz memory exhaustion HOT 2
- Problem with deleting .zip file HOT 1
- Exclude directories from UnifiedArchive::archiveFiles HOT 2
- open($fileName, password: given) broken HOT 3
- NelexaZip driver returns DateTimeImmutable as modificationTime HOT 1
- getComment() throws but should return null instead HOT 2
- mime_content_type($fileName) cannot work because of strtolower($fileName) HOT 1
- *.img / zstd ? HOT 2
- Rar+password "mount archive" produce unreadable file HOT 1
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 unifiedarchive.