Add "--unpack" option for "pack" command #25
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
--unpack
option can be used to filter out files that should not be packed into the.asar
archives but will also be used by apps. The unpacked files will be put under.asar.unpacked
folder, and that folder should be shipped together with.asar
archive.This requires changes in atom-shell to work.
Why
In Node under some cases we can only operate on real files instead of files packed in one archive, examples are
fs.open
,child_process.execFile
, andprocess.dlopen
which is used to load native modules. Our current implementation will first copy out the file to filesystem, and then pass it to those APIs, by introducing--unpack
option we can eliminate the extra copy.And it also solves the problem that some virus scanners would alert when we copy shared libraries from asar archives to filesystem (electron/electron#1205).
Example
$ asar pack input output.asar --unpack *.node $ ls output.asar output.asar.unpacked