Giter Site home page Giter Site logo

doom-fish / rar-stream Goto Github PK

View Code? Open in Web Editor NEW
16.0 3.0 5.0 2.78 MB

Library for "unpacking" and reading files inside rar archives as node Readable streams.

License: MIT License

JavaScript 1.35% TypeScript 98.65%
rar stream compression rar-stream

rar-stream's People

Contributors

1313 avatar cfal avatar dependabot[bot] avatar jaruba avatar tymmesyde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rar-stream's Issues

Filtering, Max Files and Supporting URLs

Hi! We've been playing with your module for the last few days and were hoping to include it in Stremio's local streaming server.

I wanted to share our experience with it. ๐Ÿ˜„

Specifically this code gave us a bit of trouble:

while (fileOffset < rarFile.length - TerminatorHeaderParser.HEADER_SIZE) {
const fileHead = await parseHeader(FileHeaderParser, rarFile, fileOffset);
if (fileHead.type !== 116) {
break;
}
if (fileHead.method !== 0x30) {
throw new Error("Decompression is not implemented");
}
fileOffset += fileHead.headSize;
fileChunks.push({
name: fileHead.name,
fileHead,
chunk: new RarFileChunk(
rarFile,
fileOffset,
fileOffset + fileHead.size - 1
),
});
fileOffset += fileHead.size;
}

This is used to traverse the archive in order to read the file headers and prepare the file chunks.

We stress tested it with some cases, one being a 175gb archive with many files included, which would take many tens of seconds until it finished parsing the file list due to the code linked above.

We thus added some options:

{
  "fileIdx": 1,
  "fileMustInclude": ["hello world", "/dexter/i"]
}

These were added so we can stop parsing when we find the file that we require, and also to skip adding the file chunks for all files we do not require. (you can see the changes here: https://github.com/Stremio/rar-stream/blob/ee358ffe86b7060e554aa326a14d15e6f0cb739d/src/rar-files-package.ts#L55-L95 )

As far as we can tell the traversal to get the file list needs to be sequential and there is no shortcut to this method.

We were thinking that one way that we could continue using this module (and not a fork of it) would be to possibly simplify these options so they could be useful for more users, such as:

{
  "maxFiles": 1,
  "filter": (filename, fileIdx) => {
    return filename.includes('hello world')
  }
}

Otherwise, you did absolutely amazing work! I kept stumbling over your module through the years and kept disregarding it because I couldn't wrap my mind around what missing decompression means for RAR archives, and it randomly came to me recently that we don't need decompression at all for our usecase.

Our experiments lead to making this module: https://github.com/stremio/rar-http

It adds support for URLs and uses an HTTP API. I believe that support for URLs could also be added directly to your module, but if we want to keep the spirit of a self-contained (no dependencies) module, it may be hassle to use the http / https modules directly for this task.

We're mostly curious about your opinion on all of this, and if you would even accept PRs for such changes.

Thank you for building rar-stream!

Will there be support for decompression?

I am using cloud commander. A nice way to manage files in web browser. Unfortunately I can't decompress rar files (coderaiser/cloudcmd#222). The author of the app mentioned that it uses rar-stream and rar-steam would not support it.

Will there be support for decompression? Really looking forward to see this feature coming.

Documentation

Is there some basic documentation anywhere?

Does it load the extracted files into memory?

Does it work with partial archives (e.g. .R00 is complete, R01 is not)?

Thank you

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.