fx unarchive-package

unarchive a Fuchsia package archive in FAR format

Usage: fx unarchive-package <.far file> [ --out-dir <output directory> ]

The script unarchives a Fuchsia package archive in FAR format and puts the
contents in the output directory. Files in the package will be renamed and
arranged according to its meta/contents file.

The command will by default create a directory with the same name as the .far
file under the current directory, which can be overridden by --output-dir
option. If --output-dir is an existing directory, then a sub-directory with
the same name as the .far file will be created.

Note: although a Fuchsia package archive is in FAR format, not all .far files
are valid Fuchsia packages! Also, This tool only works with fuchsia package
archives, although it could be extended in the future to work with plain
fuchsia packages.

Example:
  $ fx unarchive-package foo.far
  Unarchived foo.far under foo

  # directory "foo" will be created as
  $ tree foo
  foo
  ├── bin
  │   └── foo
  ├── lib
  │   ├── ld.so.1
  │   ├── libc++abi.so.1
  │   ├── libc++.so.2
  │   ├── libfdio.so
  │   └── libunwind.so.1
  └── meta
      ├── contents
      ├── foo_component.cm
      └── package

  $ fx unarchive-package foo.far --out-dir foo2  # assuming foo2 doesn't exist
  Unarchived foo.far under foo2

  $ fx unarchive-package foo.far --out-dir /tmp
  Unarchived foo.far under /tmp/foo

unarchive-package source code