dudulaopo833 / Tools-Learning

各种杂七杂八-错误处理等
0 stars 0 forks source link

Nodejs #10

Open dudulaopo833 opened 7 years ago

dudulaopo833 commented 7 years ago

Link:

http://nodejs.cn/api/fs.html
https://nodejs.org/api/process.html

内置对象

  1. process.env -> 进程
  2. !usr/bin/env node

  3. fs -> filesystem
  4. crypto -> 加密
  5. path -> 路径

疑点:

c. module.exports / exports: 只有 node 支持的导出;

  1. exports 是module.exports的一个引用;module 是一个对象,有exports 属性;exports = module.exports = {};
  2. 最终暴露出去(最后真正被require出去的)的是module.exports 这个属性,exports 仅仅为了方便module.exports 添加内容!
  3. Tips: CommonJS定义的模块分为: 模块标识(module)、模块定义(exports) 、模块引用(require)