types.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use strict'
  2. // map types from key to human-friendly name
  3. exports.name = new Map([
  4. ['0', 'File'],
  5. // same as File
  6. ['', 'OldFile'],
  7. ['1', 'Link'],
  8. ['2', 'SymbolicLink'],
  9. // Devices and FIFOs aren't fully supported
  10. // they are parsed, but skipped when unpacking
  11. ['3', 'CharacterDevice'],
  12. ['4', 'BlockDevice'],
  13. ['5', 'Directory'],
  14. ['6', 'FIFO'],
  15. // same as File
  16. ['7', 'ContiguousFile'],
  17. // pax headers
  18. ['g', 'GlobalExtendedHeader'],
  19. ['x', 'ExtendedHeader'],
  20. // vendor-specific stuff
  21. // skip
  22. ['A', 'SolarisACL'],
  23. // like 5, but with data, which should be skipped
  24. ['D', 'GNUDumpDir'],
  25. // metadata only, skip
  26. ['I', 'Inode'],
  27. // data = link path of next file
  28. ['K', 'NextFileHasLongLinkpath'],
  29. // data = path of next file
  30. ['L', 'NextFileHasLongPath'],
  31. // skip
  32. ['M', 'ContinuationFile'],
  33. // like L
  34. ['N', 'OldGnuLongPath'],
  35. // skip
  36. ['S', 'SparseFile'],
  37. // skip
  38. ['V', 'TapeVolumeHeader'],
  39. // like x
  40. ['X', 'OldExtendedHeader'],
  41. ])
  42. // map the other direction
  43. exports.code = new Map(Array.from(exports.name).map(kv => [kv[1], kv[0]]))