xref: /libuv/docs/src/guide/introduction.rst (revision f1635257)
1Introduction
2============
3
4This 'book' is a small set of tutorials about using libuv_ as
5a high performance evented I/O library which offers the same API on Windows and Unix.
6
7It is meant to cover the main areas of libuv, but is not a comprehensive
8reference discussing every function and data structure. The `official libuv
9documentation`_ may be consulted for full details.
10
11.. _official libuv documentation: https://docs.libuv.org/en/v1.x/
12
13This book is still a work in progress, so sections may be incomplete, but
14I hope you will enjoy it as it grows.
15
16Who this book is for
17--------------------
18
19If you are reading this book, you are either:
20
211) a systems programmer, creating low-level programs such as daemons or network
22   services and clients. You have found that the event loop approach is well
23   suited for your application and decided to use libuv.
24
252) a node.js module writer, who wants to wrap platform APIs
26   written in C or C++ with a set of (a)synchronous APIs that are exposed to
27   JavaScript. You will use libuv purely in the context of node.js. For
28   this you will require some other resources as the book does not cover parts
29   specific to v8/node.js.
30
31This book assumes that you are comfortable with the C programming language.
32
33Background
34----------
35
36The node.js_ project began in 2009 as a JavaScript environment decoupled
37from the browser. Using Google's V8_ and Marc Lehmann's libev_, node.js
38combined a model of I/O -- evented -- with a language that was well suited to
39the style of programming; due to the way it had been shaped by browsers. As
40node.js grew in popularity, it was important to make it work on Windows, but
41libev ran only on Unix. The Windows equivalent of kernel event notification
42mechanisms like kqueue or (e)poll is IOCP. libuv was an abstraction around libev
43or IOCP depending on the platform, providing users an API based on libev.
44In the node-v0.9.0 version of libuv `libev was removed`_.
45
46Since then libuv has continued to mature and become a high quality standalone
47library for system programming. Users outside of node.js include Mozilla's
48Rust_ programming language, and a variety_ of language bindings.
49
50This book and the code is based on libuv version `v1.42.0`_.
51
52Code
53----
54
55All the example code and the source of the book is included as part of
56the libuv_ project on GitHub.
57Clone or Download libuv_, then build it::
58
59    sh autogen.sh
60    ./configure
61    make
62
63There is no need to ``make install``. To build the examples run ``make`` in the
64``docs/code/`` directory.
65
66.. _v1.42.0: https://github.com/libuv/libuv/releases/tag/v1.42.0
67.. _V8: https://v8.dev
68.. _libev: http://software.schmorp.de/pkg/libev.html
69.. _libuv: https://github.com/libuv/libuv
70.. _node.js: https://www.nodejs.org
71.. _libev was removed: https://github.com/joyent/libuv/issues/485
72.. _Rust: https://www.rust-lang.org
73.. _variety: https://github.com/libuv/libuv/blob/v1.x/LINKS.md
74