Description
This is more of a feature request / API suggestion:
Ideally, especially for very large files (or in the case of git, blobs), http responses should be streamed back to the client. In node, this is ideally done with Stream#pipe()
.
Currently with node-gitteh, streaming a revision of a file over a socket or to a file is impossible. I suggest that you offer a way to create both a ReadableStream
and WritableStream
that would work with a Repository instance's RawObjects. These streams would be very similar to their fs
module counterparts.
Perhaps something like:
var readStream = repo.createRawReadStream(id);
readStream.pipe(fs.createWriteStream("file.dump"));
for a read stream would be cool. The stream would periodically emit data
events. Then we could easily pipe the contents of a blob to a file, or socket, or http response, or whatever. Let me know what you think. Thanks!