Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs: What does `process.binding` mean?

I've seen process.binding('...') many times while researching through the node.js source code on github.

Can anybody explain me what this function does?

like image 350
laconbass Avatar asked Jun 04 '14 16:06

laconbass


People also ask

What is the process of binding?

For the binding process, the loose sheets of printed pages that constitute the magazine are draped together over a saddle-like holder (hence the term saddle stitching). The wire is fed into position, cut to a short length, bent into shape, and then the legs of the staple are driven through the pages.

What is a binding node?

Node. js bindings are series of methods that can be used in Node. js code which are in reality just running C++ code behind the scenes.

What does process mean in Node JS?

Node. js provides the facility to get process information such as process id, architecture, platform, version, release, uptime, upu usage etc. It can also be used to kill process, set uid, set groups, unmask etc. The process is a global object, an instance of EventEmitter, can be accessed from anywhere.

What is process argv in Node JS?

The process. argv() method is used for returning all the command-line arguments that were passed when the Node. js process was being launched. The first element will always contains the same value as process.


1 Answers

This function returns internal module, like require. It's not public, so you shouldn't rely on it in your code, but you can use it to play with node's low level objects, if you want to understand how things work.

For example, here timer_wrap binding is registered. It exports Timer constructor. In lib/timers.js it's imported

like image 200
vkurchatkin Avatar answered Sep 17 '22 21:09

vkurchatkin