Node.js 유틸리티 모듈

❮ 내장 모듈


예시

"Linus" 및 "6" 인수를 사용하여 문자열 형식 지정:

var util = require('util');
var txt = 'Congratulate %s on his %dth birthday!';
var result = util.format(txt, 'Linus', 6);

console.log(result);

정의 및 사용

Util 모듈은 일부 유틸리티 기능에 대한 액세스를 제공합니다.


통사론

애플리케이션에 Util 모듈을 포함하기 위한 구문:

var util = require('util');

유틸리티 속성 및 메서드

Method Description
debuglog() Writes debug messages to the error object
deprecate() Marks the specified function as deprecated
format() Formats the specified string, using the specified arguments
inherits() Inherits methods from one function into another
inspect() Inspects the specified object and returns the object as a string

❮ 내장 모듈