asar.extractFile is Sync
See original GitHub issueSo… I just lost a couple minutes with this and thought it was probably a minor accident or something.
asar.extractFile is not returning a promise or using a callback. I just checked out the imprint of the code and it seems you are calling disk.readFileSync.
(archive, filename) {
const filesystem = disk.readFilesystemSync(archive)
return disk.readFileSync(filesystem, filename, filesystem.getFile(filename))
}
is there a way to call extractFile Asynchronously? Thanks
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to unpack an .asar file? - node.js - Stack Overflow
From the asar documentation. (the use of npx here is to avoid to install the asar tool globally with npm install -g asar...
Read more >Application Packaging · Electron docs gitbook - imfly
An asar archive is a simple tar-like format that concatenates files into a single file. Electron can read arbitrary files from it without...
Read more >ASAR Archives - Electron
Most fs APIs can read a file or get a file's information from ASAR archives without unpacking, but for some APIs that rely...
Read more >How to use the asar.extractAll function in asar - Snyk
var extractSlaxFile = function(slaxFileName,slaxAppDir) { try { ensureAppDir(); zipper.sync.unzip(slaxFileName).save(slaxAppDir); } catch (e) { console.log("The ...
Read more >Application Packaging | Electron
An asar archive is a simple tar-like format that concatenates files into a single file. Electron can read arbitrary files from it without...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@malept You’d have to
pipe
the file as a stream and read the file from the correct offset as your stream encounters it. Super hard to implement correctly and probably not worth it in the big scheme of things@MarshallOfSound’s explanation makes sense - but that leaves me wondering how Electron’s
fs
can read individual files out of asar files?Unless I’m crazy, I think I’ve used
fs.copyFileSync
in Electron to copy files out of the asar.