Commit a7c1d09
stream: do not use crypto.DEFAULT_ENCODING in lazy_transform.js
The default encoding can be retrieved via
`require('internal/crypto/util').getDefaultEncoding` instead of
the deprecated crypto.DEFAULT_ENCODING which triggers a warning.
Background:
The require chain goes like this:
```
internal/streams/lazy_transform.js
-> crypto.js
-> internal/crypto/cipher.js (uses LazyTransform in the global scope)
-> internal/streams/lazy_transform.js
```
So when `internal/streams/lazy_transform.js` is required before
`lib/crypto.js`, we have a circular dependency and since
`internal/crypto/cipher.js` uses destructuring to use LazyTransform
we will get an error. And it can also trigger a warning if
lazy_transform.js is the first file that touches
crypto.DEFAULT_ENCODING.
PR-URL: #24396
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent bfde244 commit a7c1d09Copy full SHA for a7c1d09
File tree
Expand file treeCollapse file tree
1 file changed
+5
-2
lines changedOpen diff view settings
Filter options
- lib/internal/streams
Expand file treeCollapse file tree
1 file changed
+5
-2
lines changedOpen diff view settings
Collapse file
lib/internal/streams/lazy_transform.js
Copy file name to clipboardExpand all lines: lib/internal/streams/lazy_transform.js+5-2Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
5 | 5 | |
6 | 6 | |
7 | 7 | |
8 | | - |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
9 | 12 | |
10 | 13 | |
11 | 14 | |
| ||
22 | 25 | |
23 | 26 | |
24 | 27 | |
25 | | - |
| 28 | + |
26 | 29 | |
27 | 30 | |
28 | 31 | |
|
0 commit comments