md5-file
md5-file copied to clipboard
"File not found" error for .asar files
When processing files with .asar file extension, md5-file module reports a "file not found error".
Could you give a minimal code example to reproduce the error?
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); });
Seems to be a known issue: https://github.com/electron/electron/issues/1658
works fine when using: require("original-fs")
Hmm, I guess that we could add support for passing in a custom fs module, in the same way that the tar module works...
~~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