asar | Package asar reads and writes ASAR | Continuous Backup library
kandi X-RAY | asar Summary
kandi X-RAY | asar Summary
Package asar reads and writes ASAR (Atom-Shell Archive) archives.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Main entry point
- Decode reads an Entry from a ReaderAt .
- parseEntry parses an entry into parent .
- decodeHeader decodes an entry in the ASAR section
- walk walks the Entry tree rooted at parentPath .
- parseRoot parses a json file
- Find returns the entry with the given name .
- New returns a new Entry .
- parseFiles scans a json file
- validFilename returns true if filename is valid .
asar Key Features
asar Examples and Code Snippets
Community Discussions
Trending Discussions on asar
QUESTION
I have this little aplication that creates a PDF from a simple form in electron with html-pdf, it works fine when I run npm start(electron .), but after build when I try to generate the PDF I get this error:
A JavaScript error occurred in the mais process
Error: write EPIPE
at afterWriteDispatched(internal/stream_base_commons.js:156:25)
at writeGeneric (internal/stream_base_commons.js:147:3)
This is my main file "index.js"
...ANSWER
Answered 2021-May-23 at 21:19So I found a similar error in this post with the electron-pdf, that was solved changing the "electron-pdf" to a parent folder outer of node_module, something related with the "asar" that wasn't allowing any write operation. In my case what I needed to do was change my compiler method, so I first created a new project using the boilerplate,
"npm create-electron-app"
Which already have a method to build application that is "npm run make", it apparently solved the problem of permission issue to write with the html-pdf from the node_modules, working just fine after build.
QUESTION
I am writing an react-electron application and I noticed that when I used electron-builder to build it the binary was stuck when calling "spawn".
With "yarn start" the application can be executed without problems. Only with electron-builder it gets stuck.
Can you help ?
Thanks,
Update
It seems that the C++ binary included as part of the program can't be executed within electron. If I give the hardcoded full path to the binary it works but if I give the path from __dirname I get an error
...ANSWER
Answered 2021-May-17 at 09:56By default, Electron Builder compiles your application and packs all resources into one large archive file (think of it as a ZIP file) which can be read just fine because Electron brings support for this format known as "ASAR".
When running the built program, the code will be read from the archive. This means that __dirname
will point to a directory inside the archive. The operating system, however, cannot read from the archive. Since you did not actually include the piece of code calling child_process.spawn ()
, I can only speculate on why you get ENOTDIR
, which hints that a given path is not a directory when it was expected to be one, but I assume this is because you point to a path inside the ASAR file.
When relying on external binaries, it is a good idea to keep them outside the ASAR archive and programmatically find the path to them (which is quite complex) or by preventing Electron Builder from compiling your app into an ASAR file. However, you would also have to ask Electron Builder to include the executable in the built version of your app. This can be done by modifying your package.json
:
QUESTION
Hello have been trying to extract and repack an app.asar to update files inside the package :
await asar.extractAll(path.join(__dirname, './app.asar'),path.join(__dirname, './destfolder'));
Then changing some files in destfolder then
await asar.createPackage(path.join(__dirname, './destfolder'),path.join(__dirname, './app.asar'));
But i have been getting this error :
...ANSWER
Answered 2021-May-11 at 02:58That error is apparently coming from this line of code in the asar package's lib/filesystem.js:
QUESTION
I'm cresting electron app using node-canvas.
I generated an app-installer by the following command:
$ electron-builder --mac --x64 --config ./build_mac.js
build_mac.js
...ANSWER
Answered 2021-May-09 at 17:31The solution to fix this is put all dylibs (except under "/usr/lib" or "/System/Library/Frameworks") under the folder which is in under control of electron.
Something like this in my project: https://github.com/code4history/MaplatEditor/tree/master/assets/mac/canvas/build/Release
But just putting dylib is not working, because each dylib has information about link to other libraries.
You can check which libraries are linked from each dylib by using "otool" command, and youcan overwrite it by using "install_name_tool" command.
https://github.com/code4history/MaplatEditor/blob/master/mac_canvas_dylib
In this URL, you can find what I did for my project.
QUESTION
ANSWER
Answered 2021-Apr-01 at 07:42I Found Solution Instead of running with a mouse double click at File Explorer, I used windows command prompt to run exe, and, from there, I can find error logs.
So, I found: the some relative path is not working, because, the electron pack source code with asar.
and, some file operate is not working, etc fs.read
, fs.readDir
.
Cannot access files inside asar archive in electron app ,
So, I removed this problem.
QUESTION
I changed my workspace to Ubuntu recently, and I encountered the crashing problem.
The vscode was installed by apt. And it could be open for a few seconds, then it crashes automatically.
I tried to figure it out with the code --verbose
command. It shows
ANSWER
Answered 2021-Mar-19 at 02:52I was experiencing the same issue. I'm using Pop OS 20.04 LTS and Visual Studio Code would crash after startup. It seems the problem might be related to mixing the .snap
package installation with the .deb
package. This github comment has a solution that worked for me:
(https://github.com/microsoft/vscode/issues/118727#issuecomment-801847011)
I had to remove the vscodevscode.github-authentication/github.auth
entry from the Passwords and Keys
app.
QUESTION
I am trying to release an electron app on the Mac Apple Store (mas), my electron app uses ffmpeg to render videos. In order to release my app on the mac apple store, It needs to be sandboxed, and by default ffmpeg makes calls to external libraries so I need to statically build ffmpeg and package it with my app. My code is on the 'mas-ffmpeg-fix' branch: https://github.com/MartinBarker/digify/tree/mas-ffmpeg-fix
My static ffmpeg build works before I build my app, but after running electron-builder build --mac
, the ffmpeg executable now fails with Illegal instruction: 4
This is the full timeline of building/packaging/submitting my app to the mac apple store and where the error first appears:
In Digify repo:
clone, configure, and build static ffpmeg: “sudo rm -rf ffmpeg-mac/ && npm run download-ffmpeg”
download-ffmpeg command is inside package.json and runs this:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg-mac && cd ffmpeg-mac && ./configure pkg_config='pkg-config --static' --pkg-config-flags='--static' --libdir=/usr/local/lib --extra-version=ntd_20150128 --disable-shared --disable-lzma --enable-gpl --enable-pthreads --enable-nonfree --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libx264 --enable-static --enable-filters --enable-runtime-cpudetect && make && cd ..
Check if any dylibb files in the static ffmpeg build with command: “otool -L ffmpeg-mac/ffmpeg | grep /usr/local”
If there are any, move them to folder in desktop, run ‘otool’ again to ensure there are no dynamic libraries, rebuild static ffmpeg.
there will now be a folder 'ffmpeg-mac' which contains static versions of ffmpeg and ffprobe
Using ffmpeg with electron UI: works
Using Ffmpeg with command-line command:
/Users/martinbarker/Documents/projects/digify-new/ffmpeg-mac/ffmpeg -h
Works
- Build mac mass app with “npm run build-mas“
- When this command finishes it will output two files inside the /dist/mas/ folder: Digify.app and Digify-01.20.pkg (or whatever version number it is) Ffmpeg command-line check: /Users/martinbarker/Documents/projects/digify-new/dist/mas/Digify.app/Contents/Resources/ffmpeg -h Illegal instruction: 4
This is the first place the error appears, after building my mac mac-apple-store app, ffmpeg fails with this err.
- Sign built app with .sh file: “sh mas-sign-script.sh”
view .sh file here
- the .sh file will output Digify-mac.pkg
- Easier command to both build & sign: “sudo rm -rf dist/mas/ && npm run build-mas && sh mas-sign-script.sh”
- Upload the outputted “Digify-mac.pkg” file & submit to apple for review
Once this app gets published in the store, if you download it and try to run an ffmpeg command with the electron UI, it fails with this error:
...ANSWER
Answered 2021-Mar-08 at 21:46Turns out in electron you need to pick the output folder directory first with a file browser window before ffmpeg can write any files
QUESTION
I have an electron app that run perfectly into a dev environment with logs engine that write into file (with winston.js).
The structure of the project is this :
When I run electron-builder for packaging my app I have this struture :
- my app.asar file is into Resources directory
- my logs files are into data/logs
In dev environment I access to logs file with this winston config :
...ANSWER
Answered 2021-Mar-07 at 12:44For getting the resources and extraFiles
paths in a packaged app as described in the electron-builder docs you can use process.resourcesPath
QUESTION
My electron application is insanely big on Mac after installation. It's around 1.39GB for no apparent reason, even though it's around 70MB on Windows. I tried to unpack the dmg file to see what makes it so big then found a file called app.asar that takes a large size of the app (1.22GB) and I don't know how to unpack this file. So my question is, How to make the application's size much smaller like on windows? and what does app.asar file contain?
I'm using electron-builder to build the app by the way
...ANSWER
Answered 2021-Jan-26 at 16:25It depends on your app.
If your app is too heavy, then it might be natural.
If not; try removing unwanted packages in the node_modules
directory using npm
.
Try instructions here :
https://www.electronjs.org/docs/tutorial/application-distribution
https://github.com/electron/electron/issues/2003
You can also unpack the asar
file using:
QUESTION
I cannot get VS Code code.exe
to run properly within WSL. (I found a connected question here, but it does not solve this issue - Launch VS Code from WSL Bash).
Within WSL (any distro) we can access any executables on Windows. e.g.
...ANSWER
Answered 2021-Jan-25 at 17:22My installation has a shell script for launching VSCode in ../Microsoft VS Code/bin/code
. I'm fairly certain that it is installed with VSCode, but there's a chance it comes from the "Remote - WSL" extension.
Is that present in your installation? If so, add that bin
directory to your path (the full installer does this automatically). Then just use code
rather than code.exe
to launch from within WSL.
If not, first make sure the "Remote - WSL" extension is installed in VSCode (or better yet, the "Remote Development" extension pack, which includes the WSL support). If it's still not there after that, here are the contents of the script that should live in VSCode/bin/code
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install asar
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page