Redirect process.binding('natives').fs to global fs object
This commit is contained in:
parent
0a393eaa1c
commit
afd6f41e08
2 changed files with 6 additions and 1 deletions
|
@ -2,7 +2,7 @@ vm = require 'vm'
|
|||
|
||||
# Execute the 'fs.js' and pass the 'exports' to it.
|
||||
source = '(function (exports, require, module, __filename, __dirname) { ' +
|
||||
process.binding('natives').fs +
|
||||
process.binding('natives').originalFs +
|
||||
'\n});'
|
||||
fn = vm.runInThisContext source, { filename: 'fs.js' }
|
||||
fn exports, require, module
|
||||
|
|
|
@ -39,3 +39,8 @@ if process.type is 'browser'
|
|||
# Add support for asar packages.
|
||||
asar = require './asar'
|
||||
asar.wrapFsWithAsar fs
|
||||
|
||||
# Make graceful-fs work with asar.
|
||||
source = process.binding 'natives'
|
||||
source.originalFs = source.fs
|
||||
source.fs = "module.exports = require('fs');"
|
||||
|
|
Loading…
Reference in a new issue