Can you please post a complete example? Am Freitag, 26. April 2013 06:39:12 UTC+2 schrieb Glenn Scott: > > Thanks all, of course zlib.Unzip() did the trick. > > On Thursday, April 25, 2013 9:18:16 PM UTC-7, Martin Cooper wrote: >> >> >> >> On Thu, Apr 25, 2013 at 8:40 PM, Glenn Scott <[email protected]> wrote: >> >>> I'm missing something obvious... when I download a tarball from Github >>> and attempt to stream it to node-tar, the Extract method tells me I have an >>> invalid tar file. Any ideas? >>> >>> var tar = require( 'tar' ) >>> , request = require( 'request' ) >>> , UA = 'test/1.0' >>> , options = { headers: { "User-Agent": UA } } >>> , uri = ' >>> https://api.github.com/repos/isaacs/node-tar/tarball/master' >>> , fs = require('fs') >>> >>> >>> // this works >>> >>> request( uri, options ) >>> .pipe( fs.createWriteStream( 'out.tar' ) ) >>> .on( "end", function() { >>> console.log( 'done' ) >>> }) >>> .on( "error", function( e ) { >>> console.log( e ) >>> }) >>> >>> >>> /* >>> >>> // this doesn't work ('Error: invalid tar file') >>> >>> request( uri, options ) >>> .pipe( tar.Extract( { path: __dirname + '/extract' } ) ) >>> .on( "end", function() { >>> console.log( 'done' ) >>> }) >>> .on( "error", function( e ) { >>> console.log( e ) >>> }) >>> >> >> Right, because as Ryan mentioned, a tarball isn't a tar file, it's a >> .tar.gz file. You need something like: >> >> .pipe(zlib.Unzip()) >> .pipe( tar.Extract( { path: __dirname + '/extract' } ) ) >> >> (with the requisite error handling, of course). >> >> -- >> Martin Cooper >> >> >> >>> */ >>> >>> >>> -- >>> -- >>> Job Board: http://jobs.nodejs.org/ >>> Posting guidelines: >>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/nodejs?hl=en?hl=en >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "nodejs" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >>
-- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/95f75109-f117-4733-9230-f9c566a49f5b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
