Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd34dd9

Browse filesBrowse files
aduh95danielleadams
authored andcommitted
doc: fix code examples in crypto.md
PR-URL: #44053 Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Feng Yu <F3n67u@outlook.com>
1 parent 9fd4262 commit dd34dd9
Copy full SHA for dd34dd9

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Open diff view settings
Collapse file

‎doc/api/crypto.md‎

Copy file name to clipboardExpand all lines: doc/api/crypto.md
+7-5Lines changed: 7 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,11 @@ Example: Using `Cipher` and piped streams:
395395
import {
396396
createReadStream,
397397
createWriteStream,
398-
} from 'fs';
398+
} from 'node:fs';
399399

400400
import {
401401
pipeline
402-
} from 'stream';
402+
} from 'node:stream';
403403

404404
const {
405405
scrypt,
@@ -675,6 +675,7 @@ const decipher = createDecipheriv(algorithm, key, iv);
675675

676676
let decrypted = '';
677677
decipher.on('readable', () => {
678+
let chunk;
678679
while (null !== (chunk = decipher.read())) {
679680
decrypted += chunk.toString('utf8');
680681
}
@@ -711,6 +712,7 @@ const decipher = createDecipheriv(algorithm, key, iv);
711712

712713
let decrypted = '';
713714
decipher.on('readable', () => {
715+
let chunk;
714716
while (null !== (chunk = decipher.read())) {
715717
decrypted += chunk.toString('utf8');
716718
}
@@ -733,7 +735,7 @@ Example: Using `Decipher` and piped streams:
733735
import {
734736
createReadStream,
735737
createWriteStream,
736-
} from 'fs';
738+
} from 'node:fs';
737739
import { Buffer } from 'node:buffer';
738740
const {
739741
scryptSync,
@@ -3305,7 +3307,7 @@ Example: generating the sha256 sum of a file
33053307
```mjs
33063308
import {
33073309
createReadStream
3308-
} from 'fs';
3310+
} from 'node:fs';
33093311
import { argv } from 'node:process';
33103312
const {
33113313
createHash
@@ -3391,7 +3393,7 @@ Example: generating the sha256 HMAC of a file
33913393
```mjs
33923394
import {
33933395
createReadStream
3394-
} from 'fs';
3396+
} from 'node:fs';
33953397
import { argv } from 'node:process';
33963398
const {
33973399
createHmac

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.