asar icon indicating copy to clipboard operation
asar copied to clipboard

Missing options documentation for createPackageWithOptions function

Open fabiante opened this issue 7 years ago • 3 comments

I can't find any documentation on how asar expects the options object to look like: createPackageWithOptions(src, dest, options, callback)

Is there one?

fabiante avatar Apr 30 '18 11:04 fabiante

I was looking for this information as well. The only option I use is the transform option. I've been searching the code for various options so I can document it for my use. Could be useful to add the list here.

  • dot - used in globOptions
  • globOptions - options passed to glob() and there are a lot of possible ones. https://www.npmjs.com/package/glob
  • pattern - used to filter out files to pack?
  • ordering - maybe explained here https://github.com/atom/atom/issues/10163
  • snapshot - version, arch, builddir, snapshotdir see snapshot.js mksnapshot
  • transform - function used to transform files during pack process. see filesystem.js
  • unpack - exclude files
  • unpackDir - exclude folders.

Hopefully the README.md file will be updated, at some point, to include all the options as well as samples showing how each is used.

payitforwardnow avatar Aug 18 '18 16:08 payitforwardnow

Also found this in bin/asar.js

program.command('pack <dir> <output>')
       .alias('p')
       .description('create asar archive')
       .option('--ordering <file path>', 'path to a text file for ordering contents')
       .option('--unpack <expression>', 'do not pack files matching glob <expression>')
       .option('--unpack-dir <expression>', 'do not pack dirs matching glob <expression> or starting with literal <expression>')
       .option('--snapshot', 'create snapshot')
       .option('--exclude-hidden', 'exclude hidden files')
       .option('--sv <version>', '(snapshot) version of Electron')
       .option('--sa <arch>', '(snapshot) arch of Electron')
       .option('--sb <builddir>', '(snapshot) where to put downloaded files')

And when I run asar from the terminal without any parameters I get this

Usage: asar [options] [command]

  Manipulate asar archive files

  Options:

    -V, --version                         output the version number
    -h, --help                            output usage information

  Commands:

    pack|p [options] <dir> <output>       create asar archive
    list|l <archive>                      list files of asar archive
    extract-file|ef <archive> <filename>  extract one file from archive
    extract|e <archive> <dest>            extract archive
    *

Hope this helps. It helped me :)

payitforwardnow avatar Aug 18 '18 16:08 payitforwardnow

Please add this to the docs, wasted a lot of time looking for this missing info

eduards-vavere avatar Jan 03 '23 08:01 eduards-vavere