doc: fix .mjs syntax in crypto.md

Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>

PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
himself65andAntoine du Hamel authored and Michaël Zasso committed 2021-06-11 07:23:52 +02:00
1 parent 82c293959e
commit 17a9846920
1 file changed
+4 -6
+4 -6
View File
@@ -1518,9 +1518,7 @@ hash.end();
Example: Using `Hash` and piped streams:
```mjs
const {
createReadStream,
} = require('fs');
import { createReadStream } from 'fs';
const {
createHash,
@@ -1551,7 +1549,7 @@ Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods:
```mjs
const {
createHash,
} = require('crypto');
} = await import('crypto');
const hash = createHash('sha256');
@@ -1596,7 +1594,7 @@ its [`hash.digest()`][] method has been called.
// Calculate a rolling hash.
const {
createHash,
} = require('crypto');
} = await import('crypto');
const hash = createHash('sha256');
@@ -1691,7 +1689,7 @@ Example: Using `Hmac` objects as streams:
```mjs
const {
createHmac,
} = require('crypto');
} = await import('crypto');
const hmac = createHmac('sha256', 'a secret');