Hacker News new | ask | show | jobs
by isntitvacant 5452 days ago
this looks really cool. i was actually working along the same lines (https://github.com/chrisdickinson/tempisfugit) to get a pure JS git implementation, though now I'm a little disconcerted since your project looks so fully featured :) One question: I noticed that you got dakongai's js-deflate library working with git -- I had tons of problems with getting it to read deflated git objects (mostly, that it wouldn't deflate them at all), and I had to turn to jxgcompressor (eventually) to get inflate to work. Before I saw this, I was planning on shimming in compression support by including a simple flash-to-js bridge; but if dakongai's library works I'd definitely rather use it. Again, awesome work!
1 comments

Nice! Looks like we've done a lot of the same stuff here. Does tempisfugit require filesystem git repos currently?

Yes, there were a few issues with js-deflate, but once I figured out exactly what zlib was and what js-deflate does it fell into place. I also had to patch it to support returning the length of the compressed data read, otherwise there was no way to know how much of the stream it had consumed.

Thanks -- yeah, at the moment it's tightly bound to node's 'fs' module, though I was planning on abstracting it so you could use 'FileData' in modern browsers. I've got the three ODB's implemented (and, I think, most of the types within) -- loose, packv1, and packv2. I've also found that the jxgcompressor seems to run faster than js-deflate -- you might check that out.

I was particularly interested in different storage methods for git repositories in-browser -- like localStorage, or (for fun) writing the git data to a canvas, extracting it as a PNG, and uploading it to a static file server which would then send it back as a "cache forever" image; you could then extract all the data back out of the PNG by writing it to a canvas and running through the image data. Also fun: writing a backend that relies on Github's raw object API [1] Or, on the server, running a SQLite backend for repo data. The possibilities are endless :)

[1]: http://develop.github.com/p/object.html