Skip to content

Commit

Permalink
doc: fix code examples in crypto.md
Browse files Browse the repository at this point in the history
PR-URL: #44053
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
  • Loading branch information
aduh95 authored and juanarbol committed Oct 11, 2022
1 parent e59c095 commit 5d3b8ab
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions doc/api/crypto.md
Expand Up @@ -395,11 +395,11 @@ Example: Using `Cipher` and piped streams:
import {
createReadStream,
createWriteStream,
} from 'fs';
} from 'node:fs';

import {
pipeline
} from 'stream';
} from 'node:stream';

const {
scrypt,
Expand Down Expand Up @@ -675,6 +675,7 @@ const decipher = createDecipheriv(algorithm, key, iv);

let decrypted = '';
decipher.on('readable', () => {
let chunk;
while (null !== (chunk = decipher.read())) {
decrypted += chunk.toString('utf8');
}
Expand Down Expand Up @@ -711,6 +712,7 @@ const decipher = createDecipheriv(algorithm, key, iv);

let decrypted = '';
decipher.on('readable', () => {
let chunk;
while (null !== (chunk = decipher.read())) {
decrypted += chunk.toString('utf8');
}
Expand All @@ -733,7 +735,7 @@ Example: Using `Decipher` and piped streams:
import {
createReadStream,
createWriteStream,
} from 'fs';
} from 'node:fs';
import { Buffer } from 'node:buffer';
const {
scryptSync,
Expand Down Expand Up @@ -3287,7 +3289,7 @@ Example: generating the sha256 sum of a file
```mjs
import {
createReadStream
} from 'fs';
} from 'node:fs';
import { argv } from 'node:process';
const {
createHash
Expand Down Expand Up @@ -3373,7 +3375,7 @@ Example: generating the sha256 HMAC of a file
```mjs
import {
createReadStream
} from 'fs';
} from 'node:fs';
import { argv } from 'node:process';
const {
createHmac
Expand Down

0 comments on commit 5d3b8ab

Please sign in to comment.