Monkey patch electrons fs functions with the original ones
Electron patches the native
fs
functions
open
and
openSync
which can lead to errors when dealing with
.asar
file operations like copying and unzipping.
To avoid these errors
electron-patch-fs
brings back the native functionality.
npm install electron-patch-fs
Monkey patch the file system functions and replace them with the original ones.
This goes for the functions open
and openSync
.
Note: Repeated calls will throw an exception ( unpatch first again ).
Undo monkey patch and bring back electrons patched fs functions.
Note: Repeated calls will throw an exception ( patch first ).
const patchFs = require( 'electron-patch-fs' );
const fs = require( 'fs' );
// monkey patch the file system functions
// and replace them with the original ones
patchFs.patch();
fs.open( '/some/path/foo.asar', 'r', function() {
// undo monkey patch and bring back electrons
// patched fs functions
patchFs.unpatch();
} );
I want to thank all these people for their great work!!!