添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
叛逆的烈酒  ·  Help And Training ...·  2 月前    · 
千年单身的蛋挞  ·  mysql ...·  3 月前    · 
爱健身的麦片  ·  Accessing trace ID ...·  3 月前    · 
有腹肌的鸡蛋  ·  Content Page·  4 月前    · 

Repository files navigation

Build Status npm version npm downloads Coverage Status Uses greenkeeper.io

electron-patch-fs

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.

Install

npm install electron-patch-fs

Basic usage

patchFs.patch()

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 ).

patchFs.unpatch()

Undo monkey patch and bring back electrons patched fs functions.

Note: Repeated calls will throw an exception ( patch first ).

Example

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();
} );

Thanks

I want to thank all these people for their great work!!!

License