Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Node Cookbook

You're reading from   Node Cookbook Discover solutions, techniques, and best practices for server-side web development with Node.js 14

Arrow left icon
Product type Paperback
Published in Nov 2020
Publisher Packt
ISBN-13 9781838558758
Length 512 pages
Edition 4th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Bethany Griggs Bethany Griggs
Author Profile Icon Bethany Griggs
Bethany Griggs
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Chapter 1: Introducing Node.js 14 2. Chapter 2: Handling I/O FREE CHAPTER 3. Chapter 3: Streams, Streams, Streams 4. Chapter 4: Using Web Protocols 5. Chapter 5: Developing Node.js modules 6. Chapter 6: Exploring Node.js web Frameworks 7. Chapter 7: Working with Databases 8. Chapter 8: Testing with Node.js 9. Chapter 9: Securing Node.js Applications 10. Chapter 10: Performance Optimization 11. Chapter 11: Deploying Node.js Microservices 12. Chapter 12: Debugging Node.js 13. Other Books You May Enjoy

Chapter 2: Handling I/O

Prior to Node.js, JavaScript was predominantly used in the browser. Node.js brought JavaScript to the server and has enabled us to interact with the operating system with JavaScript. Today, Node.js is one of the most popular technologies for building server-side applications.

Node.js interacts with the operating system at a fundamental level: input and output. This chapter will explore the core APIs provided by Node.js that allow us to interact with the standard I/O, the file system, and the network stack.

This chapter will show you how to read and write files both synchronously and asynchronously. Node.js was built to handle asynchronous code and enable a non-blocking model. Understanding how to read and write asynchronous code is key learning, and it will show how to leverage the capabilities of Node.js.

We will also learn about the core modules provided by Node.js. We'll be focusing on the File System module, which enables you to interact with the file system and files.

This chapter will cover the following recipes:

  • Handling standard I/O
  • Managing files with fs module
  • Inspecting file metadata
  • Watching for file updates
  • Creating TCP server and client communication
You have been reading a chapter from
Node Cookbook - Fourth Edition
Published in: Nov 2020
Publisher: Packt
ISBN-13: 9781838558758
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime