You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start to making some incremental improvements to node compat docs (#23773)
* Start to making some incremental improvements to node compat docs
* Update src/content/docs/workers/runtime-apis/nodejs/EventEmitter.mdx
* Update src/content/docs/workers/runtime-apis/nodejs/buffer.mdx
Copy file name to clipboardExpand all lines: src/content/docs/workers/runtime-apis/nodejs/EventEmitter.mdx
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,20 +8,22 @@ import { Render } from "~/components"
8
8
9
9
<Renderfile="nodejs-compat-howto" />
10
10
11
-
An `EventEmitter` is an object that emits named events that cause listeners to be called.
11
+
An [`EventEmitter`](https://nodejs.org/docs/latest/api/events.html#class-eventemitter)
12
+
is an object that emits named events that cause listeners to be called.
12
13
13
14
```js
14
15
import { EventEmitter } from'node:events';
15
16
16
17
constemitter=newEventEmitter();
17
18
emitter.on('hello', (...args) => {
18
-
console.log(...args);
19
+
console.log(...args);// 1 2 3
19
20
});
20
21
21
22
emitter.emit('hello', 1, 2, 3);
22
23
```
23
24
24
-
The implementation in the Workers runtime fully supports the entire Node.js `EventEmitter` API. This includes the `captureRejections` option that allows improved handling of async functions as event handlers:
25
+
The implementation in the Workers runtime supports the entire Node.js `EventEmitter` API. This includes the [`captureRejections`](https://nodejs.org/docs/latest/api/events.html#capture-rejections-of-promises)
26
+
option that allows improved handling of async functions as event handlers:
Copy file name to clipboardExpand all lines: src/content/docs/workers/runtime-apis/nodejs/assert.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ import { Render } from "~/components";
7
7
8
8
<Renderfile="nodejs-compat-howto" />
9
9
10
-
The `assert` module in Node.js provides a number of useful assertions that are useful when building tests.
10
+
The [`node:assert`](https://nodejs.org/docs/latest/api/assert.html) module in Node.js provides a number of useful assertions that are useful when building tests.
Copy file name to clipboardExpand all lines: src/content/docs/workers/runtime-apis/nodejs/buffer.mdx
+11-1Lines changed: 11 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ import { Render } from "~/components"
8
8
9
9
<Renderfile="nodejs-compat-howto" />
10
10
11
-
The `Buffer` API in Node.js is one of the most commonly used Node.js APIs for manipulating binary data. Every `Buffer` instance extends from the standard [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class, but adds a range of unique capabilities such as built-in base64 and hex encoding/decoding, byte-order manipulation, and encoding-aware substring searching.
11
+
The [`Buffer`](https://nodejs.org/docs/latest/api/buffer.html) API in Node.js is one of the most commonly used Node.js APIs for manipulating binary data. Every `Buffer` instance extends from the standard [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class, but adds a range of unique capabilities such as built-in base64 and hex encoding/decoding, byte-order manipulation, and encoding-aware substring searching.
Copy file name to clipboardExpand all lines: src/content/docs/workers/runtime-apis/nodejs/crypto.mdx
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,14 @@ import { Render } from "~/components";
7
7
8
8
<Renderfile="nodejs-compat-howto" />
9
9
10
-
The `node:crypto` module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
10
+
The [`node:crypto`](https://nodejs.org/docs/latest/api/crypto.html) module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
11
11
12
12
All `node:crypto` APIs are fully supported in Workers with the following exceptions:
13
13
14
14
- The functions [generateKeyPair](https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback) and [generateKeyPairSync](https://nodejs.org/api/crypto.html#cryptogeneratekeypairsynctype-options)
15
15
do not support DSA or DH key pairs.
16
16
-`ed448` and `x448` curves are not supported.
17
+
- It is not possible to manually enable or disable [FIPS mode](https://nodejs.org/docs/latest/api/crypto.html#fips-mode).
17
18
18
19
The full `node:crypto` API is documented in the [Node.js documentation for `node:crypto`](https://nodejs.org/api/crypto.html).
0 commit comments