Coder Social home page Coder Social logo

asar's Introduction

Electron Logo

CircleCI Build Status AppVeyor Build Status Electron Discord Invite

📝 Available Translations: 🇨🇳 🇧🇷 🇪🇸 🇯🇵 🇷🇺 🇫🇷 🇺🇸 🇩🇪. View these docs in other languages on our Crowdin project.

The Electron framework lets you write cross-platform desktop applications using JavaScript, HTML and CSS. It is based on Node.js and Chromium and is used by the Visual Studio Code and many other apps.

Follow @electronjs on Twitter for important announcements.

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Installation

To install prebuilt Electron binaries, use npm. The preferred method is to install Electron as a development dependency in your app:

npm install electron --save-dev

For more installation options and troubleshooting tips, see installation. For info on how to manage Electron versions in your apps, see Electron versioning.

Platform support

Each Electron release provides binaries for macOS, Windows, and Linux.

  • macOS (Catalina and up): Electron provides 64-bit Intel and ARM binaries for macOS. Apple Silicon support was added in Electron 11.
  • Windows (Windows 10 and up): Electron provides ia32 (x86), x64 (amd64), and arm64 binaries for Windows. Windows on ARM support was added in Electron 5.0.8. Support for Windows 7, 8 and 8.1 was removed in Electron 23, in line with Chromium's Windows deprecation policy.
  • Linux: The prebuilt binaries of Electron are built on Ubuntu 20.04. They have also been verified to work on:
    • Ubuntu 18.04 and newer
    • Fedora 32 and newer
    • Debian 10 and newer

Quick start & Electron Fiddle

Use Electron Fiddle to build, run, and package small Electron experiments, to see code examples for all of Electron's APIs, and to try out different versions of Electron. It's designed to make the start of your journey with Electron easier.

Alternatively, clone and run the electron/electron-quick-start repository to see a minimal Electron app in action:

git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start

Resources for learning Electron

Programmatic usage

Most people use Electron from the command line, but if you require electron inside your Node app (not your Electron app) it will return the file path to the binary. Use this to spawn Electron from Node scripts:

const electron = require('electron')
const proc = require('node:child_process')

// will print something similar to /Users/maf/.../Electron
console.log(electron)

// spawn Electron
const child = proc.spawn(electron)

Mirrors

See the Advanced Installation Instructions to learn how to use a custom mirror.

Documentation translations

We crowdsource translations for our documentation via Crowdin. We currently accept translations for Chinese (Simplified), French, German, Japanese, Portuguese, Russian, and Spanish.

Contributing

If you are interested in reporting/fixing issues and contributing directly to the code base, please see CONTRIBUTING.md for more information on what we're looking for and how to get started.

Community

Info on reporting bugs, getting help, finding third-party tools and sample apps, and more can be found on the Community page.

License

MIT

When using Electron logos, make sure to follow OpenJS Foundation Trademark Policy.

asar's People

Contributors

1bitphoenix avatar akinoniku avatar bengotow avatar bwin avatar dependabot[bot] avatar dsanders11 avatar duncup avatar electron-roller[bot] avatar erickzhao avatar erikian avatar felixrieseberg avatar flexiondotorg avatar gerhardberger avatar hmak3d avatar hokein avatar isaacs avatar joshuawarner32 avatar kevinsawicki avatar malept avatar marshallofsound avatar matsnow avatar mmorton avatar pauliusuza avatar qix- avatar samypesse avatar vertedinde avatar yurysolovyov avatar zcbenz avatar ziqiangai avatar zp1996 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

asar's Issues

fs.createWriteStream with path that includes dots(.) failed in asar

__dirname # "/Users/mizchi/<my-project-path>/Atom.app/Contents/Resources/app/versions/0.9.0.asar"

savePath = path.join __dirname, '../1.0.0.asar'
wstream = fs.createWriteStream savePath

It failed.

Error: Invalid package /Users/mizchi/<my-project-path>/Atom.app/Contents/Resources/app/versions/1.0.0.asar

but savePath = path.join __dirname, '../1-0-0-asar' succeed.

Support for piped data

I've been looking into ways of creating/streaming application updates (GitHub releases) for atom-shell apps and as asar is the only real option which isn't "send all the sourcecode" I was wondering if there's any support for piped data (e.g. converting a GitHub source zip into an asar file without unextracting it onto the disk?)

asar pack with electron fails on MacOS

So basically what I've found is this happens...

Error: ENOENT, no such file or directory '/Users/username/Development/project/node_modules/electron-prebuilt/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Frameworks'

So I looked up the file and it exists!

The path is wrong because there is a unescaped space between "Electron" and "Framework".

Adding a "" should fix this, but I don't really want to dive into code that isn't mine.

Add Encryption Feature

Feature request:

Add the ability to encrypt the .asar archive with one or more algorithms based on client-submitted hash/seed/salt. Conversely, also add the ability read the encrypted .asar file by providing the hash/seed/salt.

This would slow down reading times, but for an added benefit for those wanting to keep their code safer. A quick Google search for .asar and instructions to unpack will be the first result.

Not running EXE files on app.asar.unpacked folder

I'm trying to execute .exe file on my asar unpacked folder but not working. I unpacked one folder (app.asar.unpacked\public) and my executable is there. Any way to make it work?

I am using asar 0.8.2

asar list error

run command ./node_modules/.bin/asar pack test-darwin-x64/test.app/Contents/Resources/app test-darwin-x64/test.app/Contents/Resources/app.asar

and then ./node_modules/.bin/asar list test-darwin-x64/test.app/Contents/Resources/app.asar there is error.
2016-04-08 4 42 09
when I delete the app directory,I can't run the app by click that icon.

the electron version is 0.37.4 ,asar version is 0.11.0,electron-packager version is 6.0.0,node version is 5.10.0

--unpack-dir seems to have different behaviors on OS X and Windows

For example, with the following tree:

dir1
  file1.txt
  dir2
    file2.txt
    dir3
      file3.txt

--unpack-dir "dir1" on OS X will unpack everything:

dir1
  file1.txt
  dir2
    file2.txt
    dir3
      file3.txt

--unpack-dir "dir1" on Windows will only unpack root-level files:

dir1
  file1.txt

--unpack-dir "dir1/**/*" on Windows will unpack everything except root-level files:

dir1
  dir2
    file2.txt
    dir3
      file3.txt

--unpack-dir "{dir1,dir1/**/*}" on Windows will unpack everything:

dir1
  file1.txt
  dir2
    file2.txt
    dir3
      file3.txt

IMO, the OS X behavior seems to be the most logical one (--unpack-dir "dir" usually means that I want to unpack the entire directory including all its content).

Filenames which have multibyte characters in them cause corrupt asar files

Simple example, creates a directory with one file in it which has a mulitbyte character filename. The pack apparently works, but list gives an error, and unpack fails silently

mkdir g
echo a >  g\女の子.txt
node ..\node_modules\asar\bin\asar  pack g t.asar
node ..\node_modules\asar\bin\asar  list t.asar
undefined:1
{"files":{"女の子.txt":{"size":8,"offset":
                                       ^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at Object.module.exports.readArchiveHeaderSync (C:\repos\eagle-print\desktop\node_modules\asar\lib\disk.js:97:20)
    at Object.module.exports.readFilesystemSync (C:\repos\eagle-print\desktop\node_modules\asar\lib\disk.js:105:21)
    at Object.module.exports.listPackage (C:\repos\eagle-print\desktop\node_modules\asar\lib\asar.js:141:17)
    at Command.<anonymous> (C:\repos\eagle-print\desktop\node_modules\asar\bin\asar:42:23)
    at Command.listener (C:\repos\eagle-print\desktop\node_modules\asar\node_modules\commander\index.js:249:8)
    at emitTwo (events.js:87:13)
    at Command.emit (events.js:172:7)
    at Command.parseArgs (C:\repos\eagle-print\desktop\node_modules\asar\node_modules\commander\index.js:480:12)
    at Command.parse (C:\repos\eagle-print\desktop\node_modules\asar\node_modules\commander\index.js:372:21)

not a valid app for electron

OS: win7/win10
electron: 1.2.5
asar: 0.11

The app directory containing non- English path(eg.中文.txt) packaged into app.asar,

Electron report Error : Unable to find a valid app.

CoffeeScript -> ES6

Would you guys be up for moving from CoffeeScript to ES6 for this package? I can take a crack at it in the coming weeks if so.

LSOpenURLsWithRole() failed with error -10810

MacOSX: El Capitan 10.11.4
RAM: 16GB
asar: v0.11.0
electron: v1.0.2
node-java: 0.7.0

If I leave my application as a simple folder it works correctly but if I use asar to package it I get this error.

LSOpenURLsWithRole() failed with error -10810 for the file /Users/myself/GitRepositories/3rdparty/electron/out/D/Electron.app.

out of space ENOSPC

I did ;

asar pack . output.asar

. : Refering to my actual app, standard nodejs.

I just wanted to see what would come out of that. But the archive wasn't able to complete cause i had no more space on my drive. The archive at that point was about 14GB. What the hell is going on ? My app total weight about : 400K including node_modules.

Spawn ENOENT

Not sure if is an issue with asar or electron,anyway I've packed my app in an asar archive and everything works fine, except when a module tries to spawn a process calling an archived executable file:

Uncaught Error: spawn C:\Program Files (x86)\TestApp\resources\app.asar\node_modules\pageres\node_modules\screenshot-stream\node_modules\phantom-bridge\node_modules\phantomjs\lib\phantom\phantomjs.exe ENOENT

I've tried to extract the archive and the file is indeed there, so where's the problem?

I'm running on Windows 7 x64 and Electron 0.26.1, using the latest asar (0.6.1).

Thanks,

When using --unpack, the directory info is not updated

I used the command asar pack app app.asar --unpack *.dll to exclude a single dll from my asar.

The file was extracted to the correct directory and it was removed from the asar file, however the dll still appears in a directory listing and when you try to extract all the files with asar e app.asar tmp it fails on that file:

fs.js:427
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory  'D:\dev\...

Changes to the asar format? Magic number, checksum, filesize

Currently an asar archive consists of these parts:

HEADERSIZE HEADER FILES

I would like to add a magic number(/string) to the beginning like 'ASAR' or something similar.
This would be backwards incompatible, but we could read it in the old format if it doesn't start with the magic string and show a deprecation notice for now.
Why? Currently we would read any file, interpret the first 8 bytes as UINT64 and try to read that much bytes and try to interpret that as json. Although this works, IMHO a magic number (or file signature) would be a nicer way.

If you're (@zcbenz) ok with the idea, how about adding a checksum too? (When you do incompatible changes do them all at once.) In normal operation the checksum can be ignored, but it could be used to check the integrity of the file when someone wants to.
It would also be possible to put the checksum into the json-header, but I don't like that.

I'm also in favor of #4, putting the filesize at the end. (This one doesn't break anything.)

BTW is there a reason that the header (json-filelist) gets pickled and not just written to the file? Is this faster or better in any way?

I'm also aware, that these changes need to be reflected in atom-shell to have any meaning at all.

It could look like this:

MAGIC HEADERSIZE CHECKSUM HEADER FILES FILESIZE

The position of HEADERSIZE and CHECKSUM could also be switched, I don't care.

Pack with MAC OS and extract with Windows 8.

I have a file named a in my app. Dir is app/x/a and it link to app/x/b.
When I extract app with Windows 8

E:\electron-v0.35.0-win32-x64\resources>asar e app.asar .\asds\  
C:\Users\nan\AppData\Roaming\npm\node_modules\asar\lib\filesystem.js:116
        return node.files[name];
                   ^

After reading code I found this file json is

x : {file : {link : app/x/b}}

but path.sep is \ on Windows so Filesystem can't find it.

fails with an error "No such file or directory"

when trying to extract all files from an .asar file I'm getting such an error.

asar extract app.asar ./app
fs.js:565
fs.write = function(fd, buffer, offset, length, position, callback) {
                                                 ^
Error: ENOENT, no such file or directory '/Users/maddev/Documents/projects/personal/slack/app.asar.unpacked/node_modules/cld-atom-shell/build/Release/cld.node'
    at Error (native)
    at Object.fs.openSync (fs.js:500:18)
    at Object.fs.readFileSync (fs.js:352:15)
    at Object.module.exports.readFileSync (/opt/local/lib/node_modules/asar/lib/disk.js:121:19)
    at Object.module.exports.extractAll (/opt/local/lib/node_modules/asar/lib/asar.js:115:24)
    at Command.<anonymous> (/opt/local/lib/node_modules/asar/bin/asar:53:15)
    at Command.listener (/opt/local/lib/node_modules/asar/node_modules/commander/index.js:249:8)
    at Command.emit (events.js:110:17)
    at Command.parseArgs (/opt/local/lib/node_modules/asar/node_modules/commander/index.js:480:12)
    at Command.parse (/opt/local/lib/node_modules/asar/node_modules/commander/index.js:372:21)

what is the problem here?
thx

Access node_modules outside of app

According to this plugin for Grunt: https://www.npmjs.com/package/grunt-asar

You could have a separate asar archive for your app code and your node_modules.

So basically you could have a structure like:

package.json
Gruntfile.js
app
-- index.html
-- main.js
node_modules
-- grunt-asar
-- grunt-build-atom-shell

But how would you require node_modules from within the app folder that were up a level?

e.g.

var myPackage = require('package');

Could I do:

var myPackage = require('../package');

And what about when they are in an asar archive? So the structure is:

package.json
Gruntfile.js
app.asar
modules.asar

Could I do:

var myPackage = require('asar:/modules.asar/package');

--unpack-dir does not unpack symlinks

asar.unpackDir does not unpack symlinks into app.asar.unpacked/mydir (files and subdirectories are unpacked there, symlinks are not).

Tested with relative symlinks that points to files inside the directory that is being unpacked on OS X.

Invalid package name.asar at invalidArchiveError

Hey team,

I'm getting this error when trying to use the asar pragmatically

[Error: Invalid package name.asar at invalidArchiveError (ATOM_SHELL_ASAR.js:138:13) at Objec…]
0: Error: Invalid package name.asar at invalidArchiveError (ATOM_SHELL_ASAR.js:138:13) at Object.module.(anonymous function) [as open] (ATOM_SHELL_ASAR.js:193:16) at WriteStream.open (fs.js:1927:6) at new WriteStream (fs.js:1917:10) at Object.fs.createWriteStream (fs.js:1873:10) at Object.module.exports.writeFilesystem (C:\WT-NMP\WWW\node_modules\asar\lib\disk.js:69:14) at C:\WT-NMP\WWW\node_modules\asar\lib\asar.js:120:21 at C:\WT-NMP\WWW\node_modules\asar\node_modules\mkdirp\index.js:48:26 at FSReqWrap.oncomplete (fs.js:82:15)
message: "Invalid package name.asar"

code:

 var asar = require('asar');
                                                                                        var src = './muffin';
                                                                                        var dest = 'name.asar';

                                                                                        asar.createPackage(src, dest, function() {
                                                                                          console.log('Finished Packing into file');
                                                                                          console.log(arguments);


                                                                                        });

Unable to install asar

> sudo sudo npm install -g asar

> [email protected] install /usr/local/lib/node_modules/asar/node_modules/chromium-pickle/node_modules/native-mate
> echo



> [email protected] install /usr/local/lib/node_modules/asar/node_modules/chromium-pickle
> node-gyp rebuild

gyp ERR! UNCAUGHT EXCEPTION 
gyp ERR! stack Error: EPERM, utime '/Users/Subash/.node-gyp/0.10.31'
gyp ERR! System Darwin 14.0.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/asar/node_modules/chromium-pickle
gyp ERR! node -v v0.10.31
gyp ERR! node-gyp -v v1.0.1
gyp ERR! This is a bug in `node-gyp`.
gyp ERR! Try to update node-gyp and file an Issue if it does not help:
gyp ERR!     <https://github.com/TooTallNate/node-gyp/issues>
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the chromium-pickle package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls chromium-pickle
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 14.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "asar"
npm ERR! cwd /Users/Subash
npm ERR! node -v v0.10.31
npm ERR! npm -v 1.4.27
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/Subash/npm-debug.log
npm ERR! not ok code 0

How to start asar on windows?

I'm new to node and javascript. I have installed asar in Windows 7 via "npm install asar". But how can I start it? "asar --help" does not do it. "asar" is not in path. I can only find an "asar.js" but no exe file. How to use this tool in Windows 7?

asar pack failure on mac osx

I get the following error on osx

/usr/local/lib/node_modules/asar/lib/filesystem.js:36
node = this.searchNodeFromDirectory(path.dirname(p)).files[name] = {};
^

TypeError: Cannot set property 'libnode.dylib' of undefined

Allow specifying unpacked directory location

I am packaging an application in Electron and using asar to do this. My application has a cfg folder that end users are allowed to edit to change core behavior of my application. I've specified all files in the cfg folder to remain unpacked, but this means users would navigate to resources/app.asar.unpacked/cfg instead of just cfg from the root level of the installation to make their changes.

It would be nice if there was a means by which to specify where unpacked files for asar are stored. Something like the following, maybe:

asar.createPackageWithOptions(appDir, buildDir, {"unpack": "*/cfg/*", "unpackedDirectory": "../"}, function () {
        ...
    });

Add ChangeLog

Could you add a ChangeLog to the repository? It would be very helpful to figure out how safe it is to upgrade asar in downstream projects.

A ".cache" folder ?

Hello,

I recently check this asar work and I'm a little bit confuse.
When I pack something everything seems to work but when I try to extract this .asar file, there's a .cache folder and now I'm wondering why this folder is create ? Can I delete it ?

Other interesting thing to know, when I pack something that I've just extract before and put it in my app only some changes are applied (generally in index.js), some changes on my src folder are not saved. Why ? Something with this cache folder ?

Command that I do:

  • asar extract app.asar ./sources/
  • Make some changes
  • (in sources folder) asar pack ./ ../app.asar

Thank you :)

Error while executing asar archive

Hi,

I am trying to run an app with Electron using asar archive. It gives archive parsing error.

This is my app that I have created for debugging purpose which gives the same error. When executed directly with Electron, it works. I created an archive with asar pack calculator app.asar

And then put this newly created archive under electron-v0.25.3-darwin-x64/Electron.app/Contents/Resources and execute it. It gives following error.

Lion:~ vinayakmote$ /Users/vinayakmote/Downloads/electron-v0.25.3-darwin-x64/Electron.app/Contents/MacOS/Electron
[4555:0520/152250:ERROR:archive.cc(147)] Failed to parse header: Line: 1, column: 478873, Syntax error.
[4557:0520/152251:INFO:renderer_main.cc(207)] Renderer process started

Can you please give me some pointers on what could be going wrong here?

Possible failure of asar with segfault

i've filed electron-userland/electron-prebuilt#44 where i report the following output (in a dialog box):

Uncaught Exception:
Error: Module version mismatch. Expected 44, got 14.
    at Error (native)
    at Object.module.(anonymous function) (ATOM_SHELL_ASAR.js:137:20)
    at Object.module.(anonymous function) [as .node] (ATOM_SHELL_ASAR.js:137:20)
    at Module.load (module.js:353:32)
    at Function.Module._load (module.js:308:12)
    at Module.require (module.js:363:17)
    at require (module.js:382:17)
    at bindings (/private/tmp/test-electron/node_modules/segfault-handler/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/private/tmp/test-electron/node_modules/segfault-handler/index.js:3:37)
    at Module._compile (module.js:428:26)

It does look like asar is involved.

asar packager may skip files and folders

It seems like it is happending because it is run as part of build process which involves folder copying/moving, but IMO this is not excuse.
Examples: (same script run 3 times)

D:\Projects\Quazar\new\client>npm run build && dir runtime\resources

> quazar@ build D:\Projects\Quazar\new\client
> node build.js

cleaned up
styles ready
static ready
asar ready
 Volume in drive D is MYMEDIA
 Volume Serial Number is 3261-F1B9

 Directory of D:\Projects\Quazar\new\client\runtime\resources

19.03.2015  22:33    <DIR>          .
19.03.2015  22:33    <DIR>          ..
19.03.2015  22:33           469 941 app.asar
18.03.2015  18:22           115 284 atom.asar
               2 File(s)        585 225 bytes
               2 Dir(s)  109 286 617 088 bytes free

D:\Projects\Quazar\new\client>npm run build && dir runtime\resources

> quazar@ build D:\Projects\Quazar\new\client
> node build.js

cleaned up
styles ready
static ready
asar ready
 Volume in drive D is MYMEDIA
 Volume Serial Number is 3261-F1B9

 Directory of D:\Projects\Quazar\new\client\runtime\resources

19.03.2015  22:33    <DIR>          .
19.03.2015  22:33    <DIR>          ..
19.03.2015  22:33           470 561 app.asar
18.03.2015  18:22           115 284 atom.asar
               2 File(s)        585 845 bytes
               2 Dir(s)  109 286 617 088 bytes free

D:\Projects\Quazar\new\client>npm run build && dir runtime\resources

> quazar@ build D:\Projects\Quazar\new\client
> node build.js

cleaned up
styles ready
static ready
asar ready
 Volume in drive D is MYMEDIA
 Volume Serial Number is 3261-F1B9

 Directory of D:\Projects\Quazar\new\client\runtime\resources

19.03.2015  22:35    <DIR>          .
19.03.2015  22:35    <DIR>          ..
19.03.2015  22:35           469 096 app.asar
18.03.2015  18:22           115 284 atom.asar
               2 File(s)        584 380 bytes
               2 Dir(s)  109 286 617 088 bytes free

as you can see there are 3 different sizes:

469 941 app.asar
470 561 app.asar
469 096 app.asar

Problem seems to be solved by https://github.com/bwin/asar/commit/308d5ca commit.
Build script is here
I'm also in favor of using glob since it seems to be better maintained, not sure if it performs faster/slower, but at least for me it is reliable.
cc / @bwin

Support file exclusion/inclusion

When I run asar pack . app.asar the result is 75MB! It must be including node_modules/atom-package-manager and when I asar list app.asar it looks like it's even bundled up .git — so much for using this to "protect your app's resources and source code from the users" like ill-advisedly claimed!

Can an option be provided to exclude directories, or manually list files to bundle?

fs.access seems to doesn't work

I packaged my electron app with latest NPM electron and electron-packager with --asar option, where I have function:

fs.access(__dirname + "/preload.js", fs.F_OK | fs.R_OK, (err) => {
    console.log("fs.access:");
    console.log(err);
    fs.exists(__dirname + "/preload.js", (exists) => {
      console.log("fs.exists: " + exists);
    });
  });

When I run it in with electron(vanilla or packaged), its return:

fs.access:
null
fs.exists: true

but when I package it with --asar, it says:

fs.access:
{ Error: ENOENT: no such file or directory, access 'C:\Users\gamel\Desktop\SteamManager\steammanager-win32-x64\resources\app.asar\preload.js'
    at Error (native)
  errno: -4058,
  code: 'ENOENT',
  syscall: 'access',
  path: 'C:\\Users\\gamel\\Desktop\\SteamManager\\steammanager-win32-x64\\resources\\app.asar\\preload.js' }
fs.exists: true

I checked the app.asar if it's contains my file, and it is. Any ideas?

Release extract command

Would it be possible to do an npm release (0.2.0?) with the code implementing the extract (whole archive) command, which is present in master? That'd be really useful in my use-case.

Running asar from a file

I have the following in a JS file:

var asar = require('asar');

var src = 'hello-world';
var dest = 'app.asar';

asar.createPackage(src, dest, function() {
  console.log('done.');
})

and then I run it in the terminal with:

node /Users/cameron/atom-shell/asar.js

But I get the error:

events.js:74
        throw TypeError('Uncaught, unspecified "error" event.');
              ^
TypeError: Uncaught, unspecified "error" event.
    at TypeError (<anonymous>)
    at EventEmitter.emit (events.js:74:15)
    at EventEmitter.<anonymous> (/Users/cameron/node_modules/asar/node_modules/walkdir/walkdir.js:194:15)
    at EventEmitter.g (events.js:180:16)
    at EventEmitter.emit (events.js:98:17)
    at fn (/Users/cameron/node_modules/asar/node_modules/walkdir/walkdir.js:62:17)
    at Object.oncomplete (fs.js:107:15)

What's the problem?

I also get this error when doing: asar pack /Users/cameron/atom-shell/hello-world app.asar so something seems to be wrong...

Does Windows' file path length limit apply to files in the archive?

I mean how Windows has a 256 character limit on file paths. This has caused a lot of issues in the past with NW.js and I'm sure it must be the same with Electron. I wonder is using asar a workaround? I'm not sure how asar works though. If a file is requested in the archive, does it then at some point actually exist on disk with that file path?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.