All Projects → electron → Asar

electron / Asar

Licence: mit
Simple extensive tar-like archive format with indexing

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Asar

Chicago Brick
Software that displays content on a multi-node video wall.
Stars: ✭ 127 (-93.26%)
Mutual labels:  chrome
Codenav
Better code navigation in github
Stars: ✭ 133 (-92.94%)
Mutual labels:  chrome
Herakeylogger
Chrome Keylogger Extension | Post Exploitation Tool
Stars: ✭ 138 (-92.68%)
Mutual labels:  chrome
Gm
UserScripts for Firefox, Chrome and etc
Stars: ✭ 127 (-93.26%)
Mutual labels:  chrome
Vue Electron Chrome
基于electron开发的应用浏览器
Stars: ✭ 132 (-92.99%)
Mutual labels:  chrome
Passcards
A 1Password-compatible command-line and web-based password manager
Stars: ✭ 134 (-92.89%)
Mutual labels:  chrome
Squidwarc
Squidwarc is a high fidelity, user scriptable, archival crawler that uses Chrome or Chromium with or without a head
Stars: ✭ 125 (-93.37%)
Mutual labels:  chrome
Keepassbrowserimporter
KeePass 2.x plugin which imports credentials from various browsers.
Stars: ✭ 139 (-92.62%)
Mutual labels:  chrome
Nook
🎹🐻 Nook is a Chrome/Firefox extension that plays Animal Crossing hourly themes.
Stars: ✭ 133 (-92.94%)
Mutual labels:  chrome
Xstyle
A user styles manager for Firefox and Chrome
Stars: ✭ 138 (-92.68%)
Mutual labels:  chrome
Chrome Qrcode
⚡️ A Chrome plugin to Genrate QRCode of URL / Text, or Decode the QRcode in website. 一个Chrome浏览器插件,用于生成当前URL或者选中内容的二维码,同时可以用于解析网页上的二维码内容。
Stars: ✭ 129 (-93.15%)
Mutual labels:  chrome
Simple Chrome Custom Tabs
Easy integration of Chrome Custom Tabs into your project. Just connect it to your activity, and navigate to the external website styling your tab as you wish.
Stars: ✭ 131 (-93.05%)
Mutual labels:  chrome
Whatsapp Bulk Sender
Send bulk messages right from your WhatsApp Android Client or WhatsApp Web
Stars: ✭ 135 (-92.83%)
Mutual labels:  chrome
Blocker Database
A global domain based database for NoScript, uBlock, uMatrix & ScriptSafe
Stars: ✭ 127 (-93.26%)
Mutual labels:  chrome
Surfingkeys Conf
A SurfingKeys configuration which adds 130+ key mappings for 20+ sites & OmniBar search suggestions for 50+ sites
Stars: ✭ 137 (-92.73%)
Mutual labels:  chrome
Phpchrometopdf
A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface
Stars: ✭ 127 (-93.26%)
Mutual labels:  chrome
React Chrome Extension
Chrome Extension boilerplate with ReactJS and vanilla JS examples
Stars: ✭ 134 (-92.89%)
Mutual labels:  chrome
Extension
Simple browser extension for managing accounts in a browser and allowing the signing of extrinsics using these accounts. Also provides a simple interface for compliant extensions for dapps.
Stars: ✭ 139 (-92.62%)
Mutual labels:  chrome
Synology Download Manager
An open source browser extension for adding/managing download tasks to your Synology DiskStation.
Stars: ✭ 138 (-92.68%)
Mutual labels:  chrome
Scratchaddons
All-in-one browser extension for Scratch.
Stars: ✭ 133 (-92.94%)
Mutual labels:  chrome

asar - Electron Archive

CircleCI build status dependencies npm version

Asar is a simple extensive archive format, it works like tar that concatenates all files together without compression, while having random access support.

Features

  • Support random access
  • Use JSON to store files' information
  • Very easy to write a parser

Command line utility

Install

This module requires Node 10 or later.

$ npm install --engine-strict asar

Usage

$ asar --help

  Usage: asar [options] [command]

  Commands:

    pack|p <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


  Options:

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

Excluding multiple resources from being packed

Given:

    app
(a) ├── x1
(b) ├── x2
(c) ├── y3
(d) │   ├── x1
(e) │   └── z1
(f) │       └── x2
(g) └── z4
(h)     └── w1

Exclude: a, b

$ asar pack app app.asar --unpack-dir "{x1,x2}"

Exclude: a, b, d, f

$ asar pack app app.asar --unpack-dir "**/{x1,x2}"

Exclude: a, b, d, f, h

$ asar pack app app.asar --unpack-dir "{**/x1,**/x2,z4/w1}"

Using programatically

Example

const asar = require('asar');

const src = 'some/path/';
const dest = 'name.asar';

await asar.createPackage(src, dest);
console.log('done.');

Please note that there is currently no error handling provided!

Transform

You can pass in a transform option, that is a function, which either returns nothing, or a stream.Transform. The latter will be used on files that will be in the .asar file to transform them (e.g. compress).

const asar = require('asar');

const src = 'some/path/';
const dest = 'name.asar';

function transform (filename) {
  return new CustomTransformStream()
}

await asar.createPackageWithOptions(src, dest, { transform: transform });
console.log('done.');

Using with grunt

There is also an unofficial grunt plugin to generate asar archives at bwin/grunt-asar.

Format

Asar uses Pickle to safely serialize binary value to file, there is also a node.js binding of Pickle class.

The format of asar is very flat:

| UInt32: header_size | String: header | Bytes: file1 | ... | Bytes: file42 |

The header_size and header are serialized with Pickle class, and header_size's Pickle object is 8 bytes.

The header is a JSON string, and the header_size is the size of header's Pickle object.

Structure of header is something like this:

{
   "files": {
      "tmp": {
         "files": {}
      },
      "usr" : {
         "files": {
           "bin": {
             "files": {
               "ls": {
                 "offset": "0",
                 "size": 100,
                 "executable": true,
                 "integrity": {
                   "algorithm": "SHA256",
                   "hash": "...",
                   "blockSize": 1024,
                   "blocks": ["...", "..."]
                 }
               },
               "cd": {
                 "offset": "100",
                 "size": 100,
                 "executable": true,
                 "integrity": {
                   "algorithm": "SHA256",
                   "hash": "...",
                   "blockSize": 1024,
                   "blocks": ["...", "..."]
                 }
               }
             }
           }
         }
      },
      "etc": {
         "files": {
           "hosts": {
             "offset": "200",
             "size": 32,
             "integrity": {
                "algorithm": "SHA256",
                "hash": "...",
                "blockSize": 1024,
                "blocks": ["...", "..."]
              }
           }
         }
      }
   }
}

offset and size records the information to read the file from archive, the offset starts from 0 so you have to manually add the size of header_size and header to the offset to get the real offset of the file.

offset is a UINT64 number represented in string, because there is no way to precisely represent UINT64 in JavaScript Number. size is a JavaScript Number that is no larger than Number.MAX_SAFE_INTEGER, which has a value of 9007199254740991 and is about 8PB in size. We didn't store size in UINT64 because file size in Node.js is represented as Number and it is not safe to convert Number to UINT64.

integrity is an object consisting of a few keys:

  • A hashing algorithm, currently only SHA256 is supported.
  • A hex encoded hash value representing the hash of the entire file.
  • An array of hex encoded hashes for the blocks of the file. i.e. for a blockSize of 4KB this array contains the hash of every block if you split the file into N 4KB blocks.
  • A integer value blockSize representing the size in bytes of each block in the blocks hashes above
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].