Geekbrains Node JS. Урок 1. Знакомство с Node.js

Устанавливаем модуль ansi

npm install ansi

В файле app.js пишем код

const ansi = require("ansi");
const cursor = ansi(process.stdout);
cursor.beep();

Запускаем

node app

Домашнее задание
Создать с помощью Node.js API консольную программу, которая будет выводить что-либо в консоль разными цветами и издавать звук(и) с помощью модуля или модулей, отличных от рассмотренного на уроке

// 1 https://www.npmjs.com/package/ansi
const ansi = require("ansi");
const cursor = ansi(process.stdout);
cursor
  .red() 
  .bg.grey() 
  .write("Hello World!"
  .bg.reset() 
  .write("\n"); 

// 2 https://libraries.io/npm/beepbeep
const beepbeep = require("beepbeep");
beepbeep(31000);

// 3 https://www.npmjs.com/package/cli-color
const clicolor = require("cli-color");
console.log(clicolor.red("Text in red"));
console.log(clicolor.yellow("Text in yellow"));
console.log(clicolor.green("Text in green"));

// 4 https://libraries.io/npm/colors
const colors = require("colors");
console.log("hello".green);
console.log("i like cake and pies".underline.red);
console.log("inverse the color".inverse);
console.log("OMG Rainbows!".rainbow);
console.log("Run the trap".trap);