Node.js formatted console output

后端 未结 6 609
说谎
说谎 2021-01-31 13:24

Is there a simple built-in way to output formatted data to console in Node.js?

Indent, align field to left or right, add leading zeros?

6条回答
  •  暖寄归人
    2021-01-31 13:51

    If you have simpler needs you can look into util.format. It can generate string from various parameters. If you want printf like formatting you can use either sprintf package or sprintf-js package.

提交回复
热议问题