Skip to content

doc: add esm examples to `node:console`

This PR adds the ESM counterparts of the CJS examples for the Console documentation.

It also includes the missing require statements for fs and Console used in this particular CJS example just to be concise with the rest of the documentation (as in stream.pipeline(streams[, options]) for example).

Also the documentation states we can either do:

//CJS
const { Console } = require('node:console');
//ESM
import { Console } from 'node:console';

Or

const { Console } = console;

I've kept that on both the ESM and CJS examples so new users don't get confused about it.

Best regards.

Merge request reports

Loading