Core ModulesLesson 34Free preview
Util Module
This lesson is part of Node.js · All levels
Summary
The util module provides a variety of helpers often needed when developing Node applications. Its main features are promisify to convert callback API to Promise, inspect to view object structure, and format to compile strings. This module facilitates the migration of old code to modern asynchronous styles.
Key points
- Turn the callback error-first function into Promise
- Util.inspect displays a string representation of a complex object
- Util.format compose a string with placeholders like %s and %d
- Util.inherit (long) replaced class syntax in modern JavaScript
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.