You might want to take a look at the npm code that unpacks package
tarballs. The key function is gunzTarPerm, here:

https://github.com/isaacs/npm/blob/master/lib/utils/tar.js#L191

Note that extractEntry gets to futz with each entry as it goes by:

https://github.com/isaacs/npm/blob/master/lib/utils/tar.js#L212

Hope that helps.

--
Martin Cooper


On Wed, Aug 21, 2013 at 3:53 PM, Brian Lalor <[email protected]> wrote:

> This isn't pertinent to core node.js, but I'm hoping someone might be able
> to give me a hand.  I want to accomplish the equivalent of "tar -cf
> output.tar -C /tmp/whatever ."  with Isaac's fstream[1] and tar[2] modules.
>  Unfortunately I find the documentation really lacking; maybe I'm just
> missing something?
>
> Here's essentially the code I'm using:
>
>             fstream.Reader({ path: "/tmp/path/to/root, type: "Directory" })
>                 .pipe(tar.Pack())
>                 .pipe(zlib.createGzip())
>                 .pipe(fstream.Writer({
>                     path: path.join("output.tar.gz"),
>                     type: "File"
>                 }));
>
> This is based on a gist[3].  If "/tmp/path/to/root/file.js" is a file,
> then output.tar.gz will contain the path "root/file.js", which is kind of
> weird.  What I want to do is modify the path to each file, but I don't know
> where to start.  I only have a rough grasp of streams, and I can't really
> figure out how the data and metadata flow from the fstream.Reader.  Does
> anyone have any pointers?
>
> Thanks,
> Brian
>
> [1]: https://github.com/isaacs/fstream
> [2]: https://github.com/isaacs/node-tar
> [3]: https://gist.github.com/nicolasfont/2040815
>
> --
> Brian Lalor
> [email protected]
> http://github.com/blalor
>
>  --
> --
> 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/
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.

Reply via email to