"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/asar/bin/asar" (11 Apr 2017, 2364 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env node
    2 var asar = require('../lib/asar');
    3 var program = require('commander');
    4 
    5 program.version('v' + require('../package.json').version)
    6        .description('Manipulate asar archive files')
    7 
    8 program.command('pack <dir> <output>')
    9        .alias('p')
   10        .description('create asar archive')
   11        .option('--ordering <file path>', 'path to a text file for ordering contents')
   12        .option('--unpack <expression>', 'do not pack files matching glob <expression>')
   13        .option('--unpack-dir <expression>', 'do not pack dirs matching glob <expression> or starting with literal <expression>')
   14        .option('--snapshot', 'create snapshot')
   15        .option('--exclude-hidden', 'exclude hidden files')
   16        .option('--sv <version>', '(snapshot) version of Electron')
   17        .option('--sa <arch>', '(snapshot) arch of Electron')
   18        .option('--sb <builddir>', '(snapshot) where to put downloaded files')
   19        .action(function(dir, output, options) {
   20          var options = {
   21            unpack: options.unpack,
   22            unpackDir: options.unpackDir,
   23            snapshot: options.snapshot,
   24            ordering: options.ordering,
   25            version: options.sv,
   26            arch: options.sa,
   27            builddir: options.sb,
   28            dot: !options.excludeHidden
   29          };
   30          asar.createPackageWithOptions(dir, output, options, function(error) {
   31            if (error) {
   32              console.error(error.stack);
   33              process.exit(1);
   34            }
   35          });
   36        });
   37 
   38 program.command('list <archive>')
   39        .alias('l')
   40        .description('list files of asar archive')
   41        .action(function(archive) {
   42          files = asar.listPackage(archive);
   43          for (i in files)
   44            console.log(files[i]);
   45        });
   46 
   47 program.command('extract-file <archive> <filename>')
   48        .alias('ef')
   49        .description('extract one file from archive')
   50        .action(function(archive, filename) {
   51          require('fs').writeFileSync(require('path').basename(filename),
   52                                      asar.extractFile(archive, filename));
   53        });
   54 
   55 program.command('extract <archive> <dest>')
   56        .alias('e')
   57        .description('extract archive')
   58        .action(function(archive, dest) {
   59          asar.extractAll(archive, dest);
   60        });
   61 
   62 program.parse(process.argv);
   63 
   64 if (program.args.length == 0)
   65   program.help();