laconbass laconbass - 7 months ago 28
Javascript Question

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?

Answer

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

Comments