28
18

More than 5 years have passed since last update.

asarを使ってみる

Last updated at Posted at 2016-08-31

asarとは

複数のファイル・ディレクトリを一つのファイルにパックする、tarのような仕組みです。Electronでアプリをパッケージ化するためにGitHubが作りました。リポジトリはこちら

zip等と違ってファイルを圧縮せずにオリジナルのまま保持するのでランダムアクセスが容易です。ファイル構造が単純なため、パーサーを書くのも簡単です。
とりあえず基本的な使い方だけさくっと覚えましょう。

インストール

Node.jsをインストールしていない場合は先にインストールしてください。
ターミナルで以下のコマンドを実行すると、asarコマンドが使用できるようになります。

npm install -g asar

アーカイブを作成する

例:mydirディレクトリをarchive.asarファイルにパックするには以下のコマンドを実行します。

asar pack mydir archive.asar

アーカイブを展開する

例:archive.asarファイルをoutputディレクトリに展開するには、以下のコマンドを実行します。

asar extract archive.asar output
28
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
28
18