From 657c65a015b355e1bbcd492b9d8e2bea2574f0a9 Mon Sep 17 00:00:00 2001 From: himself65 Date: Tue, 1 Jun 2021 14:47:52 +0800 Subject: [PATCH] doc: fix .mjs syntax in crypto.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Antoine du Hamel PR-URL: https://github.com/nodejs/node/pull/38882 Reviewed-By: Antoine du Hamel Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Darshan Sen --- doc/api/crypto.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index e9a2be8f26ef90..8bd28d20b0c6ee 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -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');