I find that when i execute only node then it gets the 'require' and 
'module'.
And when i run it with a test_file.js like "node test_file.js" and print 
the global in it, the global does not have the 'require'.

But *then how does the very next line that uses 'require' does not throw 
the error *?

the *contents *of test_file.js is 

console.log(global);
var fs = require('fs');
console.log("\n\nAFTER********************************************************\n\n");
console.log(global);

and *output *is :

{ ArrayBuffer: [Function: ArrayBuffer],
  // ------ A lot of things -------------
  global: [Circular],
  process: 
   { title: 'C:\\Windows\\system32\\cmd.exe - node  c:\\CEF\\readFile.js ',
     version: 'v0.10.18',
  /// ------ A lot of things -------------
  Buffer: 
   { [Function: Buffer]
     isEncoding: [Function],
     poolSize: 8192,
     isBuffer: [Function: isBuffer],
     byteLength: [Function],
     concat: [Function] },
  setTimeout: [Function],
  setInterval: [Function],
  clearTimeout: [Function],
  clearInterval: [Function],
  setImmediate: [Function],
  clearImmediate: [Function],
  console: [Getter] }


AFTER********************************************************


{ ArrayBuffer: [Function: ArrayBuffer],
  // ------ A lot of things -------------
  global: [Circular],
  process: 
   { title: 'C:\\Windows\\system32\\cmd.exe - node  c:\\CEF\\readFile.js ',
     version: 'v0.10.18',
  /// ------ A lot of things -------------
  Buffer: 
   { [Function: Buffer]
     isEncoding: [Function],
     poolSize: 8192,
     isBuffer: [Function: isBuffer],
     byteLength: [Function],
     concat: [Function] },
  setTimeout: [Function],
  setInterval: [Function],
  clearTimeout: [Function],
  clearInterval: [Function],
  setImmediate: [Function],
  clearImmediate: [Function],
  console: [Getter] }


And without any file like running node.exe printing console shows :

> { ArrayBuffer: [Function: ArrayBuffer],
// -------- A lot of things here ------------
  Buffer: 
   { [Function: Buffer]
     isEncoding: [Function],
     poolSize: 8192,
     isBuffer: [Function: isBuffer],
     byteLength: [Function],
     concat: [Function],
     _charsWritten: 2 },
  setTimeout: [Function],
  setInterval: [Function],
  clearTimeout: [Function],
  clearInterval: [Function],
  setImmediate: [Function],
  clearImmediate: [Function],
  console: [Getter],
*  module: *
*   { id: 'repl',*
*     exports: *
*      { writer: [Object],*
*        _builtinLibs: [Object],*
*        REPLServer: [Object],*
*        start: [Function],*
*        repl: [Object] },*
*     parent: undefined,*
*     filename: 'C:\\Users\\asnegi\\repl',*
*     loaded: false,*
*     children: [],*
*     paths: *
*      [ 'C:\\Users\\asnegi\\repl\\node_modules',*
*        'C:\\Users\\asnegi\\node_modules',*
*        'C:\\Users\\node_modules',*
*        'C:\\node_modules' ] },*
*  require: *
*   { [Function: require]*
*     resolve: [Function],*
*     main: undefined,*
*     extensions: { '.js': [Function], '.json': [Function], '.node': 
[Function] },*
*     registerExtension: [Function],*
*     cache: {} } }*


-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to