afdsdsafadwer
afdsdsafadwer

Reputation: 67

Nodejs compilation flow

I have read some great articles about nodejs architecture. Many of they give detailed explanation about C/C++ binding, V8 engine and libuv and also nodejs features like event-driven and non-block I/O. But few talk about the flow.

I find the following figure in another post about nodejs compilation flow

this

The flow is clear, but how exactly javascript work with c++ libraries to do stuff like file system or network access? Does nodejs compile javascript into c++ coding so that it can do the server side operations?

Upvotes: 1

Views: 361

Answers (1)

rsp
rsp

Reputation: 111346

Node uses libuv for most of that. See:

It exposes the functionality provided by libuv to V8. See:

See this tutorial to see how such bindings look like:

You can think of Node as V8 binding of libuv. When you read the documentation of libuv and for V8, you will get some feel of how they both can be combined together - and their combination is basically the answer to your questions.

Take a look at the Node source code:

Just looking around a repo can give you a good feel of how it all works.

Upvotes: 3

Related Questions