Nodejs: What does `process.binding` mean?

laconbass picture laconbass · Jun 4, 2014 · Viewed 13.7k times · Source

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?

Answer

vkurchatkin picture vkurchatkin · Jun 4, 2014

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