mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
doc: add node: prefix for all core modules
Some core modules can be loaded with or without the `node:` prefix. Using the prefix disambiguates which specifiers refer to core modules. This commit updates the docs to use the prefix everywhere a core module is referenced. PR-URL: https://github.com/nodejs/node/pull/42752 Fixes: https://github.com/nodejs/node/issues/38343 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
This commit is contained in:
1 parent
29976a356b
commit
cc398a829b
58 files changed
+1640
-1632
No files matched your search
@@ -6,18 +6,18 @@
|
||||
|
||||
<!-- source_link=lib/string_decoder.js -->
|
||||
|
||||
The `string_decoder` module provides an API for decoding `Buffer` objects into
|
||||
strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
|
||||
The `node:string_decoder` module provides an API for decoding `Buffer` objects
|
||||
into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16
|
||||
characters. It can be accessed using:
|
||||
|
||||
```js
|
||||
const { StringDecoder } = require('string_decoder');
|
||||
const { StringDecoder } = require('node:string_decoder');
|
||||
```
|
||||
|
||||
The following example shows the basic use of the `StringDecoder` class.
|
||||
|
||||
```js
|
||||
const { StringDecoder } = require('string_decoder');
|
||||
const { StringDecoder } = require('node:string_decoder');
|
||||
const decoder = new StringDecoder('utf8');
|
||||
|
||||
const cent = Buffer.from([0xC2, 0xA2]);
|
||||
@@ -36,7 +36,7 @@ In the following example, the three UTF-8 encoded bytes of the European Euro
|
||||
symbol (`€`) are written over three separate operations:
|
||||
|
||||
```js
|
||||
const { StringDecoder } = require('string_decoder');
|
||||
const { StringDecoder } = require('node:string_decoder');
|
||||
const decoder = new StringDecoder('utf8');
|
||||
|
||||
decoder.write(Buffer.from([0xE2]));
|
||||
|
||||
Reference in new issue
Block a user