Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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