md5-file icon indicating copy to clipboard operation
md5-file copied to clipboard

"File not found" error for .asar files

Open SHuckel opened this issue 7 years ago • 6 comments
trafficstars

When processing files with .asar file extension, md5-file module reports a "file not found error".

SHuckel avatar Jan 30 '18 09:01 SHuckel

Could you give a minimal code example to reproduce the error?

LinusU avatar Jan 30 '18 09:01 LinusU

Sure:

require("md5-file")( "/path/to/file.asar", (err, hash) => { if (err) { console.log(err); } else console.log(hash); });

Actually, same error occurs with fs.readFile:

require("fs").readFile("/path/to/file.asar", (err, data) => { console.log(err); });

SHuckel avatar Jan 30 '18 09:01 SHuckel

Seems to be a known issue: https://github.com/electron/electron/issues/1658

SHuckel avatar Jan 30 '18 09:01 SHuckel

works fine when using: require("original-fs")

SHuckel avatar Jan 30 '18 09:01 SHuckel

Hmm, I guess that we could add support for passing in a custom fs module, in the same way that the tar module works...

LinusU avatar Jan 30 '18 10:01 LinusU

~~There is no need for that. Just use this line of code:~~

process.noAsar = true;

Don't use it. It obviously breaks support for app.asar (when its running in production), my bad.

source https://xwartz.gitbooks.io/electron-gitbook/content/en/tutorial/application-packaging.html

zardoy avatar Feb 27 '21 01:02 zardoy