Initial commit
[yaffs-website] / node_modules / tar / README.md
1 # node-tar
2
3 Tar for Node.js.
4
5 [![NPM](https://nodei.co/npm/tar.png)](https://nodei.co/npm/tar/)
6
7 ## API
8
9 See `examples/` for usage examples.
10
11 ### var tar = require('tar')
12
13 Returns an object with `.Pack`, `.Extract` and `.Parse` methods.
14
15 ### tar.Pack([properties])
16
17 Returns a through stream. Use
18 [fstream](https://npmjs.org/package/fstream) to write files into the
19 pack stream and you will receive tar archive data from the pack
20 stream.
21
22 This only works with directories, it does not work with individual files.
23
24 The optional `properties` object are used to set properties in the tar
25 'Global Extended Header'. If the `fromBase` property is set to true,
26 the tar will contain files relative to the path passed, and not with
27 the path included.
28
29 ### tar.Extract([options])
30
31 Returns a through stream. Write tar data to the stream and the files
32 in the tarball will be extracted onto the filesystem.
33
34 `options` can be:
35
36 ```js
37 {
38   path: '/path/to/extract/tar/into',
39   strip: 0, // how many path segments to strip from the root when extracting
40 }
41 ```
42
43 `options` also get passed to the `fstream.Writer` instance that `tar`
44 uses internally.
45
46 ### tar.Parse()
47
48 Returns a writable stream. Write tar data to it and it will emit
49 `entry` events for each entry parsed from the tarball. This is used by
50 `tar.Extract`.