fs.js中的process.binding('fs')是什么? [英] What is `process.binding('fs')` in `fs.js`?

查看:71
本文介绍了fs.js中的process.binding('fs')是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到在 fs.js 的顶部有一个 process.binding('fs').

I see in top of the fs.js there is a process.binding('fs').

https://github.com/nodejs/node/blob/master/lib/fs.js#L10 :

const binding = process.binding('fs');

然后,它用作:

binding.open(pathModule._makeLong(path),
           stringToFlags(flag),
           0o666,
           req);

(在 https://github.com/nodejs/node/blob/master/lib/fs.js#L303-L306 )

我的问题是:

  • process.binding('fs')是什么意思?
  • 这里的 fs 是什么(我们已经在 fs.js 中了)?
  • 在哪里可以找到 binding.open 的源代码?是Javascript代码还是c/c ++代码?
  • What does process.binding('fs') mean?
  • What's fs here (We already in fs.js)?
  • Where can I find the source code of binding.open? Is it Javascript code or c/c++ code?

推荐答案

  1. process.binding()是节点使用的内部API,用于获取对各种核心C ++绑定的引用.
  2. process.binding('fs')中的
  3. 'fs'是对 C ++绑定(此处并在
  1. process.binding() is an internal API used by node to get a reference to the various core C++ bindings.
  2. 'fs' in process.binding('fs') is a reference to the C++ binding (src/node_file.cc in the node source tree) for the fs module.
  3. As mentioned, process.binding() references C++ bindings, so in this case binding.open() is exported here and defined here.

这篇关于fs.js中的process.binding('fs')是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆