Skip to Content
JavaScript: The Definitive Guide, 7th Edition
book

JavaScript: The Definitive Guide, 7th Edition

by David Flanagan
May 2020
Intermediate to advanced
706 pages
21h 15m
English
O'Reilly Media, Inc.
Book available
Content preview from JavaScript: The Definitive Guide, 7th Edition

Chapter 16. Server-Side JavaScript with Node

Node is JavaScript with bindings to the underlying operating system, making it possible to write JavaScript programs that read and write files, execute child processes, and communicate over the network. This makes Node useful as a:

  • Modern alternative to shell scripts that does not suffer from the arcane syntax of bash and other Unix shells.

  • General-purpose programming language for running trusted programs, not subject to the security constraints imposed by web browsers on untrusted code.

  • Popular environment for writing efficient and highly concurrent web servers.

The defining feature of Node is its single-threaded event-based concurrency enabled by an asynchronous-by-default API. If you have programmed in other languages but have not done much JavaScript coding, or if you’re an experienced client-side JavaScript programmer used to writing code for web browers, using Node will be a bit of an adjustment, as is any new programming language or environment. This chapter begins by explaining the Node programming model, with an emphasis on concurrency, Node’s API for working with streaming data, and Node’s Buffer type for working with binary data. These initial sections are followed by sections that highlight and demonstrate some of the most important Node APIs, including those for working with files, networks, processes, and threads.

One chapter is not enough to document all of Node’s APIs, but my hope is that this chapter will explain ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Modern JavaScript from The Beginning [Second Edition] - Second Edition

Modern JavaScript from The Beginning [Second Edition] - Second Edition

Brad Traversy
JavaScript from Beginner to Professional

JavaScript from Beginner to Professional

Rob Percival, Laurence Svekis, Maaike van Putten, Codestars By Rob Percival

Publisher Resources

ISBN: 9781491952016Errata PageSupplemental Content