News for hackers. Stuff that matters.
Re:Javascript RAR reader by thristian on Tuesday November 05, 2013 @03:55AM (#6674016)
That's interesting. So far as I know, the only documentation of the RAR compression algorithm is the official UnRAR tool¹, which (among other things) restricts you from using it to create a RAR-writer. There's also the GPL'd "unrar" based on UnRAR 2 (which doesn't handle modern RAR 3.x archives), and the GPL'd "unar"². Given that this is under the MIT licence, it can't be derived from any of those other tool, so I guess it must be a from-scratch reimplementation.

Well done!

¹: http://www.rarlab.com/rar/unrarsrc-5.0.12.tar.gz ²: http://unarchiver.c3.cx/commandline

Re:Javascript RAR reader by anonymous on Tuesday November 05, 2013 @04:25AM (#6674142)
A more likely explanation is that the author frankly doesn't give a damn about such restriction.
Re:Javascript RAR reader by _delirium on Tuesday November 05, 2013 @05:47AM (#6674382)
This doesn't look like it actually does decompression, which makes the amount of reverse-engineering it needs to do considerably less.
Re:Javascript RAR reader by justincormack on Tuesday November 05, 2013 @08:27AM (#6674879)
The GPL is a copyright license and does not apply to a reimplementation.
Re:Javascript RAR reader by tdj on Tuesday November 05, 2013 @04:30AM (#6674159)
It would be good to note that this implementation doesn't actually support de-compression (as is also noted in the to-do list).

It is able to read headers and other metadata, as well as unpack files, but only if they're stored without compression: https://github.com/43081j/rar.js/blob/master/dist/rar.js#L54...

If I understand RAR, it actually uses a embedded virtual machine to specify the compression algorithm. That would have been the fun part.

Re:Javascript RAR reader by newsmaster on Tuesday November 05, 2013 @03:35AM (#6673939)
Very nice. Client side JS is getting more and more powerful. I've been playing with a JS gif compiler lately and I'm amazed it's even possible.
Re:Javascript RAR reader by bigd on Tuesday November 05, 2013 @07:56AM (#6674772)
$(document).ready(unrar(totallyL3git.rar))
Re:Javascript RAR reader by bigd on Tuesday November 05, 2013 @07:59AM (#6674788)
Better explain before the shitstorm: I find it a neat idea, but is is something like this possibly dangerous?
Re:Javascript RAR reader by talles on Tuesday November 05, 2013 @06:09AM (#6674453)
Extremely useful, nice.
Re:Javascript RAR reader by goggles99 on Tuesday November 05, 2013 @04:21AM (#6674124)
Is this just a POC to prove that JavaScript can be fast? This is a serious question. I am having a difficult time thinking of practical uses for this.
Re:Javascript RAR reader by lmm on Tuesday November 05, 2013 @04:30AM (#6674165)
Imagine a photo-sharing webapp that allowed users to drag a rar file in and then pick which images to upload.

I'm sure there are other use cases, but that one immediately comes to mind.

Re:Javascript RAR reader by kybernetyk on Tuesday November 05, 2013 @07:48AM (#6674753)
I don't know ... that sounds like a pretty rare edge case.

Photos you usually want to share are JPGs and 'raring' them doesn't do much good in terms of space saving.

The only image files you'd like to compress are those that are taking too much space (tiffs, raw images, etc). And if you take the extra effort to put them into an archive it's likely that they are taking up really a lot of space.

Thus it's very very likely that even one of those images is too big to upload it to the internet (tens of megabytes if not more) with today's common end user internet connections.

Re:Javascript RAR reader by lmm on Tuesday November 05, 2013 @10:34AM (#6675578)
People often have collections of images that are kept in rars or zips not for compression (which as you say this is no good for) but for convenience and organization. Or consider e.g. the "cbr" pseudo-format, where comics are stored as a rar of images, one per page. I can well imagine a web-based CBR viewer.