Using this library you can inject your own files into .asar archives.
const patchAsar = require('patch-asar')
const path = require('path')
const inputAsar = path.join(__dirname, "input.asar")
const patchFolder = path.join(__dirname, "patches")
patchAsar(inputAsar, patchFolder).then(()=>{
console.log("Successfully Patched .asar archive in place")
}).catch(error => {
console.log(error)
})
You can supply an object as the third argument to supply additional options.
...
await patchAsar(inputAsar, patchFolder, {outputFile: path.join(__dirname, 'output.asar')})
...
The output .asar file path. If this option is not provided it will overwrite the original .asar file.
Allows you to specify the directory you would like the library to work in
A file ending in .patch-execute will be evaluated as Javascript in order to generate it's contents. The .patch-execute extension will be removed automatically during the build process. It should either export a string, or a function returning a string, or a promise returning a string. If you return a function while theres another file with the same name except without .patch-execute then the contents of the file will be passed in as a string input to your function. This can be very useful in order to generate the contents of the patched file based on the contents of the unpatched file and the code you provide in your .patch-execute file.