Skip to content

Commit 17a9846

Browse files
himself65targos
authored andcommitted
doc: fix .mjs syntax in crypto.md
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: #38882 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 82c2939 commit 17a9846

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

doc/api/crypto.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,7 @@ hash.end();
15181518
Example: Using `Hash` and piped streams:
15191519

15201520
```mjs
1521-
const {
1522-
createReadStream,
1523-
} = require('fs');
1521+
import { createReadStream } from 'fs';
15241522

15251523
const {
15261524
createHash,
@@ -1551,7 +1549,7 @@ Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods:
15511549
```mjs
15521550
const {
15531551
createHash,
1554-
} = require('crypto');
1552+
} = await import('crypto');
15551553

15561554
const hash = createHash('sha256');
15571555

@@ -1596,7 +1594,7 @@ its [`hash.digest()`][] method has been called.
15961594
// Calculate a rolling hash.
15971595
const {
15981596
createHash,
1599-
} = require('crypto');
1597+
} = await import('crypto');
16001598

16011599
const hash = createHash('sha256');
16021600

@@ -1691,7 +1689,7 @@ Example: Using `Hmac` objects as streams:
16911689
```mjs
16921690
const {
16931691
createHmac,
1694-
} = require('crypto');
1692+
} = await import('crypto');
16951693

16961694
const hmac = createHmac('sha256', 'a secret');
16971695

0 commit comments

Comments
 (0)