diff --git a/doc/.eslintrc.yaml b/doc/.eslintrc.yaml
index e8d24adb6e00aa..5703dc6f8584c5 100644
--- a/doc/.eslintrc.yaml
+++ b/doc/.eslintrc.yaml
@@ -15,3 +15,4 @@ rules:
# Stylistic Issues
no-multiple-empty-lines: [error, {max: 1, maxEOF: 0, maxBOF: 0}]
+ comma-dangle: [error, always-multiline]
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 7256c2745e3015..d636c70001a5bc 100644
--- a/doc/api/assert.md
+++ b/doc/api/assert.md
@@ -172,7 +172,7 @@ import assert from 'node:assert';
const { message } = new assert.AssertionError({
actual: 1,
expected: 2,
- operator: 'strictEqual'
+ operator: 'strictEqual',
});
// Verify error output:
@@ -197,7 +197,7 @@ const assert = require('node:assert');
const { message } = new assert.AssertionError({
actual: 1,
expected: 2,
- operator: 'strictEqual'
+ operator: 'strictEqual',
});
// Verify error output:
@@ -651,18 +651,18 @@ import assert from 'node:assert';
const obj1 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj2 = {
a: {
- b: 2
- }
+ b: 2,
+ },
};
const obj3 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj4 = Object.create(obj1);
@@ -686,18 +686,18 @@ const assert = require('node:assert');
const obj1 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj2 = {
a: {
- b: 2
- }
+ b: 2,
+ },
};
const obj3 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj4 = Object.create(obj1);
@@ -1066,7 +1066,7 @@ await assert.doesNotReject(
async () => {
throw new TypeError('Wrong value');
},
- SyntaxError
+ SyntaxError,
);
```
@@ -1078,7 +1078,7 @@ const assert = require('node:assert/strict');
async () => {
throw new TypeError('Wrong value');
},
- SyntaxError
+ SyntaxError,
);
})();
```
@@ -1148,7 +1148,7 @@ assert.doesNotThrow(
() => {
throw new TypeError('Wrong value');
},
- SyntaxError
+ SyntaxError,
);
```
@@ -1159,7 +1159,7 @@ assert.doesNotThrow(
() => {
throw new TypeError('Wrong value');
},
- SyntaxError
+ SyntaxError,
);
```
@@ -1173,7 +1173,7 @@ assert.doesNotThrow(
() => {
throw new TypeError('Wrong value');
},
- TypeError
+ TypeError,
);
```
@@ -1184,7 +1184,7 @@ assert.doesNotThrow(
() => {
throw new TypeError('Wrong value');
},
- TypeError
+ TypeError,
);
```
@@ -1200,7 +1200,7 @@ assert.doesNotThrow(
throw new TypeError('Wrong value');
},
/Wrong value/,
- 'Whoops'
+ 'Whoops',
);
// Throws: AssertionError: Got unwanted exception: Whoops
```
@@ -1213,7 +1213,7 @@ assert.doesNotThrow(
throw new TypeError('Wrong value');
},
/Wrong value/,
- 'Whoops'
+ 'Whoops',
);
// Throws: AssertionError: Got unwanted exception: Whoops
```
@@ -1610,18 +1610,18 @@ import assert from 'node:assert';
const obj1 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj2 = {
a: {
- b: 2
- }
+ b: 2,
+ },
};
const obj3 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj4 = Object.create(obj1);
@@ -1643,18 +1643,18 @@ const assert = require('node:assert');
const obj1 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj2 = {
a: {
- b: 2
- }
+ b: 2,
+ },
};
const obj3 = {
a: {
- b: 1
- }
+ b: 1,
+ },
};
const obj4 = Object.create(obj1);
@@ -2012,8 +2012,8 @@ await assert.rejects(
},
{
name: 'TypeError',
- message: 'Wrong value'
- }
+ message: 'Wrong value',
+ },
);
```
@@ -2027,8 +2027,8 @@ const assert = require('node:assert/strict');
},
{
name: 'TypeError',
- message: 'Wrong value'
- }
+ message: 'Wrong value',
+ },
);
})();
```
@@ -2044,7 +2044,7 @@ await assert.rejects(
assert.strictEqual(err.name, 'TypeError');
assert.strictEqual(err.message, 'Wrong value');
return true;
- }
+ },
);
```
@@ -2060,7 +2060,7 @@ const assert = require('node:assert/strict');
assert.strictEqual(err.name, 'TypeError');
assert.strictEqual(err.message, 'Wrong value');
return true;
- }
+ },
);
})();
```
@@ -2070,7 +2070,7 @@ import assert from 'node:assert/strict';
assert.rejects(
Promise.reject(new Error('Wrong value')),
- Error
+ Error,
).then(() => {
// ...
});
@@ -2081,7 +2081,7 @@ const assert = require('node:assert/strict');
assert.rejects(
Promise.reject(new Error('Wrong value')),
- Error
+ Error,
).then(() => {
// ...
});
@@ -2258,7 +2258,7 @@ err.code = 404;
err.foo = 'bar';
err.info = {
nested: true,
- baz: 'text'
+ baz: 'text',
};
err.reg = /abc/i;
@@ -2271,12 +2271,12 @@ assert.throws(
message: 'Wrong value',
info: {
nested: true,
- baz: 'text'
- }
+ baz: 'text',
+ },
// Only properties on the validation object will be tested for.
// Using nested objects requires all properties to be present. Otherwise
// the validation is going to fail.
- }
+ },
);
// Using regular expressions to validate error properties:
@@ -2294,13 +2294,13 @@ assert.throws(
info: {
nested: true,
// It is not possible to use regular expressions for nested properties!
- baz: 'text'
+ baz: 'text',
},
// The `reg` property contains a regular expression and only if the
// validation object contains an identical regular expression, it is going
// to pass.
- reg: /abc/i
- }
+ reg: /abc/i,
+ },
);
// Fails due to the different `message` and `name` properties:
@@ -2315,7 +2315,7 @@ assert.throws(
},
// The error's `message` and `name` properties will also be checked when using
// an error as validation object.
- err
+ err,
);
```
@@ -2327,7 +2327,7 @@ err.code = 404;
err.foo = 'bar';
err.info = {
nested: true,
- baz: 'text'
+ baz: 'text',
};
err.reg = /abc/i;
@@ -2340,12 +2340,12 @@ assert.throws(
message: 'Wrong value',
info: {
nested: true,
- baz: 'text'
- }
+ baz: 'text',
+ },
// Only properties on the validation object will be tested for.
// Using nested objects requires all properties to be present. Otherwise
// the validation is going to fail.
- }
+ },
);
// Using regular expressions to validate error properties:
@@ -2363,13 +2363,13 @@ assert.throws(
info: {
nested: true,
// It is not possible to use regular expressions for nested properties!
- baz: 'text'
+ baz: 'text',
},
// The `reg` property contains a regular expression and only if the
// validation object contains an identical regular expression, it is going
// to pass.
- reg: /abc/i
- }
+ reg: /abc/i,
+ },
);
// Fails due to the different `message` and `name` properties:
@@ -2384,7 +2384,7 @@ assert.throws(
},
// The error's `message` and `name` properties will also be checked when using
// an error as validation object.
- err
+ err,
);
```
@@ -2397,7 +2397,7 @@ assert.throws(
() => {
throw new Error('Wrong value');
},
- Error
+ Error,
);
```
@@ -2408,7 +2408,7 @@ assert.throws(
() => {
throw new Error('Wrong value');
},
- Error
+ Error,
);
```
@@ -2424,7 +2424,7 @@ assert.throws(
() => {
throw new Error('Wrong value');
},
- /^Error: Wrong value$/
+ /^Error: Wrong value$/,
);
```
@@ -2435,7 +2435,7 @@ assert.throws(
() => {
throw new Error('Wrong value');
},
- /^Error: Wrong value$/
+ /^Error: Wrong value$/,
);
```
@@ -2461,7 +2461,7 @@ assert.throws(
// possible.
return true;
},
- 'unexpected error'
+ 'unexpected error',
);
```
@@ -2482,7 +2482,7 @@ assert.throws(
// possible.
return true;
},
- 'unexpected error'
+ 'unexpected error',
);
```
diff --git a/doc/api/async_context.md b/doc/api/async_context.md
index 2d76d41392a525..14697ddc1678d2 100644
--- a/doc/api/async_context.md
+++ b/doc/api/async_context.md
@@ -372,7 +372,7 @@ import { AsyncResource, executionAsyncId } from 'node:async_hooks';
// new AsyncResource() also triggers init. If triggerAsyncId is omitted then
// async_hook.executionAsyncId() is used.
const asyncResource = new AsyncResource(
- type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
+ type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
);
// Run a function in the execution context of the resource. This will
@@ -400,7 +400,7 @@ const { AsyncResource, executionAsyncId } = require('node:async_hooks');
// new AsyncResource() also triggers init. If triggerAsyncId is omitted then
// async_hook.executionAsyncId() is used.
const asyncResource = new AsyncResource(
- type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }
+ type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false },
);
// Run a function in the execution context of the resource. This will
diff --git a/doc/api/async_hooks.md b/doc/api/async_hooks.md
index 99ada9240f18c2..e905e9844a9722 100644
--- a/doc/api/async_hooks.md
+++ b/doc/api/async_hooks.md
@@ -165,7 +165,7 @@ import { createHook } from 'node:async_hooks';
const asyncHook = createHook({
init(asyncId, type, triggerAsyncId, resource) { },
- destroy(asyncId) { }
+ destroy(asyncId) { },
});
```
@@ -174,7 +174,7 @@ const async_hooks = require('node:async_hooks');
const asyncHook = async_hooks.createHook({
init(asyncId, type, triggerAsyncId, resource) { },
- destroy(asyncId) { }
+ destroy(asyncId) { },
});
```
@@ -373,7 +373,7 @@ createHook({
fs.writeSync(
stdout.fd,
`${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`);
- }
+ },
}).enable();
net.createServer((conn) => {}).listen(8080);
@@ -390,7 +390,7 @@ createHook({
fs.writeSync(
stdout.fd,
`${type}(${asyncId}): trigger: ${triggerAsyncId} execution: ${eid}\n`);
- }
+ },
}).enable();
net.createServer((conn) => {}).listen(8080);
@@ -651,7 +651,7 @@ import { createServer } from 'node:http';
import {
executionAsyncId,
executionAsyncResource,
- createHook
+ createHook,
} from 'async_hooks';
const sym = Symbol('state'); // Private symbol to avoid pollution
@@ -661,7 +661,7 @@ createHook({
if (cr) {
resource[sym] = cr[sym];
}
- }
+ },
}).enable();
const server = createServer((req, res) => {
@@ -677,7 +677,7 @@ const { createServer } = require('node:http');
const {
executionAsyncId,
executionAsyncResource,
- createHook
+ createHook,
} = require('node:async_hooks');
const sym = Symbol('state'); // Private symbol to avoid pollution
@@ -687,7 +687,7 @@ createHook({
if (cr) {
resource[sym] = cr[sym];
}
- }
+ },
}).enable();
const server = createServer((req, res) => {
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index 557eb3d53a3a3d..27566c44cf9312 100644
--- a/doc/api/child_process.md
+++ b/doc/api/child_process.md
@@ -606,7 +606,7 @@ A third argument may be used to specify additional options, with these defaults:
```js
const defaults = {
cwd: undefined,
- env: process.env
+ env: process.env,
};
```
@@ -749,7 +749,7 @@ const { spawn } = require('node:child_process');
const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
- stdio: 'ignore'
+ stdio: 'ignore',
});
subprocess.unref();
@@ -765,7 +765,7 @@ const err = fs.openSync('./out.log', 'a');
const subprocess = spawn('prg', [], {
detached: true,
- stdio: [ 'ignore', out, err ]
+ stdio: [ 'ignore', out, err ],
});
subprocess.unref();
@@ -1392,8 +1392,8 @@ const subprocess = spawn(
console.log(process.pid, 'is alive')
}, 500);"`,
], {
- stdio: ['inherit', 'inherit', 'inherit']
- }
+ stdio: ['inherit', 'inherit', 'inherit'],
+ },
);
setTimeout(() => {
@@ -1449,7 +1449,7 @@ const { spawn } = require('node:child_process');
const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
- stdio: 'ignore'
+ stdio: 'ignore',
});
subprocess.unref();
@@ -1733,7 +1733,7 @@ const subprocess = child_process.spawn('ls', {
0, // Use parent's stdin for child.
'pipe', // Pipe child's stdout to parent.
fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
- ]
+ ],
});
assert.strictEqual(subprocess.stdio[0], null);
@@ -1796,7 +1796,7 @@ const { spawn } = require('node:child_process');
const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
- stdio: 'ignore'
+ stdio: 'ignore',
});
subprocess.unref();
diff --git a/doc/api/cluster.md b/doc/api/cluster.md
index 89fb26199885e9..f904272f62bdc6 100644
--- a/doc/api/cluster.md
+++ b/doc/api/cluster.md
@@ -987,12 +987,12 @@ import cluster from 'node:cluster';
cluster.setupPrimary({
exec: 'worker.js',
args: ['--use', 'https'],
- silent: true
+ silent: true,
});
cluster.fork(); // https worker
cluster.setupPrimary({
exec: 'worker.js',
- args: ['--use', 'http']
+ args: ['--use', 'http'],
});
cluster.fork(); // http worker
```
@@ -1003,12 +1003,12 @@ const cluster = require('node:cluster');
cluster.setupPrimary({
exec: 'worker.js',
args: ['--use', 'https'],
- silent: true
+ silent: true,
});
cluster.fork(); // https worker
cluster.setupPrimary({
exec: 'worker.js',
- args: ['--use', 'http']
+ args: ['--use', 'http'],
});
cluster.fork(); // http worker
```
diff --git a/doc/api/crypto.md b/doc/api/crypto.md
index 4ab859c853838c..430bd3e7ca161b 100644
--- a/doc/api/crypto.md
+++ b/doc/api/crypto.md
@@ -327,7 +327,7 @@ Example: Using `Cipher` objects as streams:
const {
scrypt,
randomFill,
- createCipheriv
+ createCipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -360,7 +360,7 @@ scrypt(password, 'salt', 24, (err, key) => {
const {
scrypt,
randomFill,
- createCipheriv
+ createCipheriv,
} = require('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -398,13 +398,13 @@ import {
} from 'node:fs';
import {
- pipeline
+ pipeline,
} from 'node:stream';
const {
scrypt,
randomFill,
- createCipheriv
+ createCipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -437,7 +437,7 @@ const {
} = require('node:fs');
const {
- pipeline
+ pipeline,
} = require('node:stream');
const {
@@ -475,7 +475,7 @@ Example: Using the [`cipher.update()`][] and [`cipher.final()`][] methods:
const {
scrypt,
randomFill,
- createCipheriv
+ createCipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -659,7 +659,7 @@ Example: Using `Decipher` objects as streams:
import { Buffer } from 'node:buffer';
const {
scryptSync,
- createDecipheriv
+ createDecipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -739,7 +739,7 @@ import {
import { Buffer } from 'node:buffer';
const {
scryptSync,
- createDecipheriv
+ createDecipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -789,7 +789,7 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods:
import { Buffer } from 'node:buffer';
const {
scryptSync,
- createDecipheriv
+ createDecipheriv,
} = await import('node:crypto');
const algorithm = 'aes-192-cbc';
@@ -987,7 +987,7 @@ Instances of the `DiffieHellman` class can be created using the
import assert from 'node:assert';
const {
- createDiffieHellman
+ createDiffieHellman,
} = await import('node:crypto');
// Generate Alice's keys...
@@ -1215,7 +1215,7 @@ Instances of the `ECDH` class can be created using the
import assert from 'node:assert';
const {
- createECDH
+ createECDH,
} = await import('node:crypto');
// Generate Alice's keys...
@@ -1291,7 +1291,7 @@ Example (uncompressing a key):
```mjs
const {
createECDH,
- ECDH
+ ECDH,
} = await import('node:crypto');
const ecdh = createECDH('secp256k1');
@@ -1463,7 +1463,7 @@ Example (obtaining a shared secret):
```mjs
const {
createECDH,
- createHash
+ createHash,
} = await import('node:crypto');
const alice = createECDH('secp256k1');
@@ -1473,7 +1473,7 @@ const bob = createECDH('secp256k1');
// keys. It would be unwise to use such a predictable private key in a real
// application.
alice.setPrivateKey(
- createHash('sha256').update('alice', 'utf8').digest()
+ createHash('sha256').update('alice', 'utf8').digest(),
);
// Bob uses a newly generated cryptographically strong
@@ -1500,7 +1500,7 @@ const bob = createECDH('secp256k1');
// keys. It would be unwise to use such a predictable private key in a real
// application.
alice.setPrivateKey(
- createHash('sha256').update('alice', 'utf8').digest()
+ createHash('sha256').update('alice', 'utf8').digest(),
);
// Bob uses a newly generated cryptographically strong
@@ -1537,7 +1537,7 @@ Example: Using `Hash` objects as streams:
```mjs
const {
- createHash
+ createHash,
} = await import('node:crypto');
const hash = createHash('sha256');
@@ -1607,7 +1607,7 @@ Example: Using the [`hash.update()`][] and [`hash.digest()`][] methods:
```mjs
const {
- createHash
+ createHash,
} = await import('node:crypto');
const hash = createHash('sha256');
@@ -1653,7 +1653,7 @@ its [`hash.digest()`][] method has been called.
```mjs
// Calculate a rolling hash.
const {
- createHash
+ createHash,
} = await import('node:crypto');
const hash = createHash('sha256');
@@ -1751,7 +1751,7 @@ Example: Using `Hmac` objects as streams:
```mjs
const {
- createHmac
+ createHmac,
} = await import('node:crypto');
const hmac = createHmac('sha256', 'a secret');
@@ -1799,7 +1799,7 @@ Example: Using `Hmac` and piped streams:
import { createReadStream } from 'node:fs';
import { stdout } from 'node:process';
const {
- createHmac
+ createHmac,
} = await import('node:crypto');
const hmac = createHmac('sha256', 'a secret');
@@ -1827,7 +1827,7 @@ Example: Using the [`hmac.update()`][] and [`hmac.digest()`][] methods:
```mjs
const {
- createHmac
+ createHmac,
} = await import('node:crypto');
const hmac = createHmac('sha256', 'a secret');
@@ -1936,7 +1936,7 @@ const { subtle } = webcrypto;
const key = await subtle.generateKey({
name: 'HMAC',
hash: 'SHA-256',
- length: 256
+ length: 256,
}, true, ['sign', 'verify']);
const keyObject = KeyObject.from(key);
@@ -1956,7 +1956,7 @@ const {
const key = await subtle.generateKey({
name: 'HMAC',
hash: 'SHA-256',
- length: 256
+ length: 256,
}, true, ['sign', 'verify']);
const keyObject = KeyObject.from(key);
@@ -2155,11 +2155,11 @@ Example: Using `Sign` and [`Verify`][] objects as streams:
const {
generateKeyPairSync,
createSign,
- createVerify
+ createVerify,
} = await import('node:crypto');
const { privateKey, publicKey } = generateKeyPairSync('ec', {
- namedCurve: 'sect239k1'
+ namedCurve: 'sect239k1',
});
const sign = createSign('SHA256');
@@ -2182,7 +2182,7 @@ const {
} = require('node:crypto');
const { privateKey, publicKey } = generateKeyPairSync('ec', {
- namedCurve: 'sect239k1'
+ namedCurve: 'sect239k1',
});
const sign = createSign('SHA256');
@@ -2203,7 +2203,7 @@ Example: Using the [`sign.update()`][] and [`verify.update()`][] methods:
const {
generateKeyPairSync,
createSign,
- createVerify
+ createVerify,
} = await import('node:crypto');
const { privateKey, publicKey } = generateKeyPairSync('rsa', {
@@ -3335,11 +3335,11 @@ Example: generating the sha256 sum of a file
```mjs
import {
- createReadStream
+ createReadStream,
} from 'node:fs';
import { argv } from 'node:process';
const {
- createHash
+ createHash,
} = await import('node:crypto');
const filename = argv[2];
@@ -3421,11 +3421,11 @@ Example: generating the sha256 HMAC of a file
```mjs
import {
- createReadStream
+ createReadStream,
} from 'node:fs';
import { argv } from 'node:process';
const {
- createHmac
+ createHmac,
} = await import('node:crypto');
const filename = argv[2];
@@ -3669,7 +3669,7 @@ Asynchronously generates a new random secret key of the given `length`. The
```mjs
const {
- generateKey
+ generateKey,
} = await import('node:crypto');
generateKey('hmac', { length: 64 }, (err, key) => {
@@ -3758,21 +3758,21 @@ It is recommended to encode public keys as `'spki'` and private keys as
```mjs
const {
- generateKeyPair
+ generateKeyPair,
} = await import('node:crypto');
generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
- format: 'pem'
+ format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
- passphrase: 'top secret'
- }
+ passphrase: 'top secret',
+ },
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
@@ -3787,14 +3787,14 @@ generateKeyPair('rsa', {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
- format: 'pem'
+ format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
- passphrase: 'top secret'
- }
+ passphrase: 'top secret',
+ },
}, (err, publicKey, privateKey) => {
// Handle errors and use the generated key pair.
});
@@ -3870,7 +3870,7 @@ and to keep the passphrase confidential.
```mjs
const {
- generateKeyPairSync
+ generateKeyPairSync,
} = await import('node:crypto');
const {
@@ -3880,14 +3880,14 @@ const {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
- format: 'pem'
+ format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
- passphrase: 'top secret'
- }
+ passphrase: 'top secret',
+ },
});
```
@@ -3903,14 +3903,14 @@ const {
modulusLength: 4096,
publicKeyEncoding: {
type: 'spki',
- format: 'pem'
+ format: 'pem',
},
privateKeyEncoding: {
type: 'pkcs8',
format: 'pem',
cipher: 'aes-256-cbc',
- passphrase: 'top secret'
- }
+ passphrase: 'top secret',
+ },
});
```
@@ -3939,7 +3939,7 @@ Synchronously generates a new random secret key of the given `length`. The
```mjs
const {
- generateKeySync
+ generateKeySync,
} = await import('node:crypto');
const key = generateKeySync('hmac', { length: 64 });
@@ -4086,7 +4086,7 @@ added: v0.9.3
```mjs
const {
- getCiphers
+ getCiphers,
} = await import('node:crypto');
console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...]
@@ -4110,7 +4110,7 @@ added: v2.3.0
```mjs
const {
- getCurves
+ getCurves,
} = await import('node:crypto');
console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
@@ -4147,7 +4147,7 @@ Example (obtaining a shared secret):
```mjs
const {
- getDiffieHellman
+ getDiffieHellman,
} = await import('node:crypto');
const alice = getDiffieHellman('modp14');
const bob = getDiffieHellman('modp14');
@@ -4201,7 +4201,7 @@ added: v0.9.3
```mjs
const {
- getHashes
+ getHashes,
} = await import('node:crypto');
console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
@@ -4272,7 +4272,7 @@ of the input arguments specify invalid values or types.
```mjs
import { Buffer } from 'node:buffer';
const {
- hkdf
+ hkdf,
} = await import('node:crypto');
hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => {
@@ -4330,7 +4330,7 @@ types, or if the derived key cannot be generated.
```mjs
import { Buffer } from 'node:buffer';
const {
- hkdfSync
+ hkdfSync,
} = await import('node:crypto');
const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64);
@@ -4410,7 +4410,7 @@ When passing strings for `password` or `salt`, please consider
```mjs
const {
- pbkdf2
+ pbkdf2,
} = await import('node:crypto');
pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => {
@@ -4505,7 +4505,7 @@ When passing strings for `password` or `salt`, please consider
```mjs
const {
- pbkdf2Sync
+ pbkdf2Sync,
} = await import('node:crypto');
const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512');
@@ -4761,7 +4761,7 @@ If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The
```mjs
// Asynchronous
const {
- randomBytes
+ randomBytes,
} = await import('node:crypto');
randomBytes(256, (err, buf) => {
@@ -4789,7 +4789,7 @@ there is a problem generating the bytes.
```mjs
// Synchronous
const {
- randomBytes
+ randomBytes,
} = await import('node:crypto');
const buf = randomBytes(256);
@@ -5082,7 +5082,7 @@ generated synchronously.
```mjs
// Asynchronous
const {
- randomInt
+ randomInt,
} = await import('node:crypto');
randomInt(3, (err, n) => {
@@ -5106,7 +5106,7 @@ randomInt(3, (err, n) => {
```mjs
// Synchronous
const {
- randomInt
+ randomInt,
} = await import('node:crypto');
const n = randomInt(3);
@@ -5126,7 +5126,7 @@ console.log(`Random number chosen from (0, 1, 2): ${n}`);
```mjs
// With `min` argument
const {
- randomInt
+ randomInt,
} = await import('node:crypto');
const n = randomInt(1, 7);
@@ -5223,7 +5223,7 @@ or types.
```mjs
const {
- scrypt
+ scrypt,
} = await import('node:crypto');
// Using the factory defaults.
@@ -5304,7 +5304,7 @@ or types.
```mjs
const {
- scryptSync
+ scryptSync,
} = await import('node:crypto');
// Using the factory defaults.
@@ -5690,7 +5690,7 @@ import { Buffer } from 'node:buffer';
const {
createCipheriv,
createDecipheriv,
- randomBytes
+ randomBytes,
} = await import('node:crypto');
const key = 'keykeykeykeykeykeykeykey';
@@ -5699,11 +5699,11 @@ const nonce = randomBytes(12);
const aad = Buffer.from('0123456789', 'hex');
const cipher = createCipheriv('aes-192-ccm', key, nonce, {
- authTagLength: 16
+ authTagLength: 16,
});
const plaintext = 'Hello world';
cipher.setAAD(aad, {
- plaintextLength: Buffer.byteLength(plaintext)
+ plaintextLength: Buffer.byteLength(plaintext),
});
const ciphertext = cipher.update(plaintext, 'utf8');
cipher.final();
@@ -5712,11 +5712,11 @@ const tag = cipher.getAuthTag();
// Now transmit { ciphertext, nonce, tag }.
const decipher = createDecipheriv('aes-192-ccm', key, nonce, {
- authTagLength: 16
+ authTagLength: 16,
});
decipher.setAuthTag(tag);
decipher.setAAD(aad, {
- plaintextLength: ciphertext.length
+ plaintextLength: ciphertext.length,
});
const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
@@ -5743,11 +5743,11 @@ const nonce = randomBytes(12);
const aad = Buffer.from('0123456789', 'hex');
const cipher = createCipheriv('aes-192-ccm', key, nonce, {
- authTagLength: 16
+ authTagLength: 16,
});
const plaintext = 'Hello world';
cipher.setAAD(aad, {
- plaintextLength: Buffer.byteLength(plaintext)
+ plaintextLength: Buffer.byteLength(plaintext),
});
const ciphertext = cipher.update(plaintext, 'utf8');
cipher.final();
@@ -5756,11 +5756,11 @@ const tag = cipher.getAuthTag();
// Now transmit { ciphertext, nonce, tag }.
const decipher = createDecipheriv('aes-192-ccm', key, nonce, {
- authTagLength: 16
+ authTagLength: 16,
});
decipher.setAuthTag(tag);
decipher.setAAD(aad, {
- plaintextLength: ciphertext.length
+ plaintextLength: ciphertext.length,
});
const receivedPlaintext = decipher.update(ciphertext, null, 'utf8');
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md
index 123cceadd300f0..c9696b58617759 100644
--- a/doc/api/deprecations.md
+++ b/doc/api/deprecations.md
@@ -3055,7 +3055,7 @@ const w = new Writable({
async final(callback) {
await someOp();
callback();
- }
+ },
});
```
diff --git a/doc/api/dgram.md b/doc/api/dgram.md
index 4c188629e2bb22..84fd2684266c3f 100644
--- a/doc/api/dgram.md
+++ b/doc/api/dgram.md
@@ -357,7 +357,7 @@ An example socket listening on an exclusive port is shown below.
socket.bind({
address: 'localhost',
port: 8000,
- exclusive: true
+ exclusive: true,
});
```
diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md
index 8f62cd3c632e81..b460b613a8a6e1 100644
--- a/doc/api/diagnostics_channel.md
+++ b/doc/api/diagnostics_channel.md
@@ -62,7 +62,7 @@ diagnostics_channel.subscribe('my-channel', onMessage);
if (channel.hasSubscribers) {
// Publish data to the channel
channel.publish({
- some: 'data'
+ some: 'data',
});
}
@@ -87,7 +87,7 @@ diagnostics_channel.subscribe('my-channel', onMessage);
if (channel.hasSubscribers) {
// Publish data to the channel
channel.publish({
- some: 'data'
+ some: 'data',
});
}
@@ -298,7 +298,7 @@ import diagnostics_channel from 'node:diagnostics_channel';
const channel = diagnostics_channel.channel('my-channel');
channel.publish({
- some: 'message'
+ some: 'message',
});
```
@@ -308,7 +308,7 @@ const diagnostics_channel = require('node:diagnostics_channel');
const channel = diagnostics_channel.channel('my-channel');
channel.publish({
- some: 'message'
+ some: 'message',
});
```
diff --git a/doc/api/esm.md b/doc/api/esm.md
index d18a6b866b15d2..9571bb11e8fef4 100644
--- a/doc/api/esm.md
+++ b/doc/api/esm.md
@@ -1024,7 +1024,7 @@ export function resolve(specifier, context, nextResolve) {
if (specifier.startsWith('https://')) {
return {
shortCircuit: true,
- url: specifier
+ url: specifier,
};
} else if (parentURL && parentURL.startsWith('https://')) {
return {
@@ -1105,7 +1105,7 @@ export async function resolve(specifier, context, nextResolve) {
// specifiers ending in the CoffeeScript file extensions.
return {
shortCircuit: true,
- url: new URL(specifier, parentURL).href
+ url: new URL(specifier, parentURL).href,
};
}
diff --git a/doc/api/events.md b/doc/api/events.md
index 4876dd6d4a639b..e776e0ec4017d1 100644
--- a/doc/api/events.md
+++ b/doc/api/events.md
@@ -1465,7 +1465,7 @@ setMaxListeners(5, target, emitter);
```cjs
const {
setMaxListeners,
- EventEmitter
+ EventEmitter,
} = require('node:events');
const target = new EventTarget();
@@ -1688,13 +1688,13 @@ async function handler2(event) {
const handler3 = {
handleEvent(event) {
console.log(event.type); // Prints 'foo'
- }
+ },
};
const handler4 = {
async handleEvent(event) {
console.log(event.type); // Prints 'foo'
- }
+ },
};
const target = new EventTarget();
diff --git a/doc/api/fs.md b/doc/api/fs.md
index c25744c8bfbce3..d3623b3be9786b 100644
--- a/doc/api/fs.md
+++ b/doc/api/fs.md
@@ -7039,7 +7039,7 @@ import { open, constants } from 'node:fs';
const {
O_RDWR,
O_CREAT,
- O_EXCL
+ O_EXCL,
} = constants;
open('/path/to/my/file', O_RDWR | O_CREAT | O_EXCL, (err, fd) => {
diff --git a/doc/api/http.md b/doc/api/http.md
index d0bebabe5c4bda..276739366328b0 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -106,7 +106,7 @@ http.get({
hostname: 'localhost',
port: 80,
path: '/',
- agent: false // Create a new agent just for this one request
+ agent: false, // Create a new agent just for this one request
}, (res) => {
// Do stuff with response
});
@@ -504,7 +504,7 @@ proxy.listen(1337, '127.0.0.1', () => {
port: 1337,
host: '127.0.0.1',
method: 'CONNECT',
- path: 'www.google.com:80'
+ path: 'www.google.com:80',
};
const req = http.request(options);
@@ -575,7 +575,7 @@ const http = require('node:http');
const options = {
host: '127.0.0.1',
port: 8080,
- path: '/length_request'
+ path: '/length_request',
};
// Make a request
@@ -673,8 +673,8 @@ server.listen(1337, '127.0.0.1', () => {
host: '127.0.0.1',
headers: {
'Connection': 'Upgrade',
- 'Upgrade': 'websocket'
- }
+ 'Upgrade': 'websocket',
+ },
};
const req = http.request(options);
@@ -2185,7 +2185,7 @@ const earlyHintsLinks = [
];
response.writeEarlyHints({
'link': earlyHintsLinks,
- 'x-trace-id': 'id for diagnostics'
+ 'x-trace-id': 'id for diagnostics',
});
const earlyHintsCallback = () => console.log('early hints message sent');
@@ -2238,7 +2238,7 @@ const body = 'hello world';
response
.writeHead(200, {
'Content-Length': Buffer.byteLength(body),
- 'Content-Type': 'text/plain'
+ 'Content-Type': 'text/plain',
})
.end(body);
```
@@ -2375,7 +2375,7 @@ server fully transmitted a message before a connection was terminated:
const req = http.request({
host: '127.0.0.1',
port: 8080,
- method: 'POST'
+ method: 'POST',
}, (res) => {
res.resume();
res.on('end', () => {
@@ -3202,7 +3202,7 @@ const http = require('node:http');
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
- data: 'Hello World!'
+ data: 'Hello World!',
}));
});
@@ -3219,7 +3219,7 @@ const server = http.createServer();
server.on('request', (request, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
- data: 'Hello World!'
+ data: 'Hello World!',
}));
});
@@ -3301,7 +3301,7 @@ http.get('http://localhost:8000/', (res) => {
const server = http.createServer((req, res) => {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
- data: 'Hello World!'
+ data: 'Hello World!',
}));
});
@@ -3459,7 +3459,7 @@ upload a file with a POST request, then write to the `ClientRequest` object.
const http = require('node:http');
const postData = JSON.stringify({
- 'msg': 'Hello World!'
+ 'msg': 'Hello World!',
});
const options = {
@@ -3469,8 +3469,8 @@ const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- 'Content-Length': Buffer.byteLength(postData)
- }
+ 'Content-Length': Buffer.byteLength(postData),
+ },
};
const req = http.request(options, (res) => {
diff --git a/doc/api/http2.md b/doc/api/http2.md
index 713edfca66376e..460d358481f0f5 100644
--- a/doc/api/http2.md
+++ b/doc/api/http2.md
@@ -90,7 +90,7 @@ const fs = require('node:fs');
const server = http2.createSecureServer({
key: fs.readFileSync('localhost-privkey.pem'),
- cert: fs.readFileSync('localhost-cert.pem')
+ cert: fs.readFileSync('localhost-cert.pem'),
});
server.on('error', (err) => console.error(err));
@@ -98,7 +98,7 @@ server.on('stream', (stream, headers) => {
// stream is a Duplex
stream.respond({
'content-type': 'text/html; charset=utf-8',
- ':status': 200
+ ':status': 200,
});
stream.end('
Hello World
');
});
@@ -121,7 +121,7 @@ The following illustrates an HTTP/2 client:
const http2 = require('node:http2');
const fs = require('node:fs');
const client = http2.connect('https://localhost:8443', {
- ca: fs.readFileSync('localhost-cert.pem')
+ ca: fs.readFileSync('localhost-cert.pem'),
});
client.on('error', (err) => console.error(err));
@@ -327,7 +327,7 @@ session.on('stream', (stream, headers, flags) => {
// ...
stream.respond({
':status': 200,
- 'content-type': 'text/plain; charset=utf-8'
+ 'content-type': 'text/plain; charset=utf-8',
});
stream.write('hello ');
stream.end('world');
@@ -348,7 +348,7 @@ const server = http2.createServer();
server.on('stream', (stream, headers) => {
stream.respond({
'content-type': 'text/html; charset=utf-8',
- ':status': 200
+ ':status': 200,
});
stream.on('error', (error) => console.error(error));
stream.end('Hello World
');
@@ -971,7 +971,7 @@ const http2 = require('node:http2');
const clientSession = http2.connect('https://localhost:1234');
const {
HTTP2_HEADER_PATH,
- HTTP2_HEADER_STATUS
+ HTTP2_HEADER_STATUS,
} = http2.constants;
const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' });
@@ -1038,7 +1038,7 @@ encoding.
```js
stream.respond({
'content-type': 'text/html; charset=utf-8',
- ':status': 200
+ ':status': 200,
});
```
@@ -1731,7 +1731,7 @@ server.on('stream', (stream) => {
const headers = {
'content-length': stat.size,
'last-modified': stat.mtime.toUTCString(),
- 'content-type': 'text/plain; charset=utf-8'
+ 'content-type': 'text/plain; charset=utf-8',
};
stream.respondWithFD(fd, headers);
stream.on('close', () => fs.closeSync(fd));
@@ -1776,7 +1776,7 @@ server.on('stream', (stream) => {
const headers = {
'content-length': stat.size,
'last-modified': stat.mtime.toUTCString(),
- 'content-type': 'text/plain; charset=utf-8'
+ 'content-type': 'text/plain; charset=utf-8',
};
stream.respondWithFD(fd, headers, { waitForTrailers: true });
stream.on('wantTrailers', () => {
@@ -2022,7 +2022,7 @@ const {
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_STATUS,
- HTTP2_HEADER_CONTENT_TYPE
+ HTTP2_HEADER_CONTENT_TYPE,
} = http2.constants;
const server = http2.createServer();
@@ -2032,7 +2032,7 @@ server.on('stream', (stream, headers, flags) => {
// ...
stream.respond({
[HTTP2_HEADER_STATUS]: 200,
- [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain; charset=utf-8'
+ [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain; charset=utf-8',
});
stream.write('hello ');
stream.end('world');
@@ -2242,7 +2242,7 @@ const {
HTTP2_HEADER_METHOD,
HTTP2_HEADER_PATH,
HTTP2_HEADER_STATUS,
- HTTP2_HEADER_CONTENT_TYPE
+ HTTP2_HEADER_CONTENT_TYPE,
} = http2.constants;
const options = getOptionsSomehow();
@@ -2254,7 +2254,7 @@ server.on('stream', (stream, headers, flags) => {
// ...
stream.respond({
[HTTP2_HEADER_STATUS]: 200,
- [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain; charset=utf-8'
+ [HTTP2_HEADER_CONTENT_TYPE]: 'text/plain; charset=utf-8',
});
stream.write('hello ');
stream.end('world');
@@ -2527,7 +2527,7 @@ const server = http2.createServer();
server.on('stream', (stream, headers) => {
stream.respond({
'content-type': 'text/html; charset=utf-8',
- ':status': 200
+ ':status': 200,
});
stream.end('Hello World
');
});
@@ -2659,7 +2659,7 @@ const fs = require('node:fs');
const options = {
key: fs.readFileSync('server-key.pem'),
- cert: fs.readFileSync('server-cert.pem')
+ cert: fs.readFileSync('server-cert.pem'),
};
// Create a secure HTTP/2 server
@@ -2668,7 +2668,7 @@ const server = http2.createSecureServer(options);
server.on('stream', (stream, headers) => {
stream.respond({
'content-type': 'text/html; charset=utf-8',
- ':status': 200
+ ':status': 200,
});
stream.end('Hello World
');
});
@@ -2889,7 +2889,7 @@ to send more than one value per header field).
const headers = {
':status': '200',
'content-type': 'text-plain',
- 'ABC': ['has', 'more', 'than', 'one', 'value']
+ 'ABC': ['has', 'more', 'than', 'one', 'value'],
};
stream.respond(headers);
@@ -2940,7 +2940,7 @@ const headers = {
'content-type': 'text-plain',
'cookie': 'some-cookie',
'other-sensitive-header': 'very secret data',
- [http2.sensitiveHeaders]: ['cookie', 'other-sensitive-header']
+ [http2.sensitiveHeaders]: ['cookie', 'other-sensitive-header'],
};
stream.respond(headers);
@@ -3126,7 +3126,7 @@ const client = http2.connect('http://localhost:8001');
// for CONNECT requests or an error will be thrown.
const req = client.request({
':method': 'CONNECT',
- ':authority': `localhost:${port}`
+ ':authority': `localhost:${port}`,
});
req.on('response', (headers) => {
@@ -3222,7 +3222,7 @@ const key = readFileSync('./key.pem');
const server = createSecureServer(
{ cert, key, allowHTTP1: true },
- onRequest
+ onRequest,
).listen(4443);
function onRequest(req, res) {
@@ -3232,7 +3232,7 @@ function onRequest(req, res) {
res.writeHead(200, { 'content-type': 'application/json' });
res.end(JSON.stringify({
alpnProtocol,
- httpVersion: req.httpVersion
+ httpVersion: req.httpVersion,
}));
}
```
diff --git a/doc/api/https.md b/doc/api/https.md
index b917cc0bd2eda5..eb5636168b54dd 100644
--- a/doc/api/https.md
+++ b/doc/api/https.md
@@ -236,7 +236,7 @@ const fs = require('node:fs');
const options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
- cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
+ cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
};
https.createServer(options, (req, res) => {
@@ -253,7 +253,7 @@ const fs = require('node:fs');
const options = {
pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
- passphrase: 'sample'
+ passphrase: 'sample',
};
https.createServer(options, (req, res) => {
@@ -380,7 +380,7 @@ const options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
- method: 'GET'
+ method: 'GET',
};
const req = https.request(options, (res) => {
@@ -407,7 +407,7 @@ const options = {
path: '/',
method: 'GET',
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
- cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
+ cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
};
options.agent = new https.Agent(options);
@@ -426,7 +426,7 @@ const options = {
method: 'GET',
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
- agent: false
+ agent: false,
};
const req = https.request(options, (res) => {
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index b0b89de1c75bf6..1c43a878683317 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -4000,7 +4000,7 @@ reasons. Consider the following JavaScript:
const obj = {};
Object.defineProperties(obj, {
'foo': { value: 123, writable: true, configurable: true, enumerable: true },
- 'bar': { value: 456, writable: true, configurable: true, enumerable: true }
+ 'bar': { value: 456, writable: true, configurable: true, enumerable: true },
});
```
diff --git a/doc/api/net.md b/doc/api/net.md
index d268d560209518..a72d3bb3a66c8a 100644
--- a/doc/api/net.md
+++ b/doc/api/net.md
@@ -487,7 +487,7 @@ shown below.
server.listen({
host: 'localhost',
port: 80,
- exclusive: true
+ exclusive: true,
});
```
@@ -507,7 +507,7 @@ const controller = new AbortController();
server.listen({
host: 'localhost',
port: 80,
- signal: controller.signal
+ signal: controller.signal,
});
// Later, when you want to close the server.
controller.abort();
@@ -937,8 +937,8 @@ net.connect({
callback: function(nread, buf) {
// Received data is available in `buf` from 0 to `nread`.
console.log(buf.toString('utf8', 0, nread));
- }
- }
+ },
+ },
});
```
diff --git a/doc/api/os.md b/doc/api/os.md
index 13feec731e80cc..5dc8f22ce12b92 100644
--- a/doc/api/os.md
+++ b/doc/api/os.md
@@ -85,8 +85,8 @@ The properties included on each object include:
nice: 0,
sys: 30340,
idle: 1070356870,
- irq: 0
- }
+ irq: 0,
+ },
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -96,8 +96,8 @@ The properties included on each object include:
nice: 0,
sys: 26980,
idle: 1071569080,
- irq: 0
- }
+ irq: 0,
+ },
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -107,8 +107,8 @@ The properties included on each object include:
nice: 0,
sys: 21750,
idle: 1070919370,
- irq: 0
- }
+ irq: 0,
+ },
},
{
model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz',
@@ -118,8 +118,8 @@ The properties included on each object include:
nice: 0,
sys: 19430,
idle: 1070905480,
- irq: 20
- }
+ irq: 20,
+ },
},
]
```
diff --git a/doc/api/packages.md b/doc/api/packages.md
index 52ba6f432bbf84..d781dfc02ccc25 100644
--- a/doc/api/packages.md
+++ b/doc/api/packages.md
@@ -1033,7 +1033,7 @@ CommonJS and ES module instances of the package:
// ./node_modules/pkg/index.mjs
import state from './state.cjs';
export {
- state
+ state,
};
```
diff --git a/doc/api/path.md b/doc/api/path.md
index 43f5a7733cffdb..d58fc044476bb9 100644
--- a/doc/api/path.md
+++ b/doc/api/path.md
@@ -238,7 +238,7 @@ For example, on POSIX:
path.format({
root: '/ignored',
dir: '/home/user/dir',
- base: 'file.txt'
+ base: 'file.txt',
});
// Returns: '/home/user/dir/file.txt'
@@ -248,7 +248,7 @@ path.format({
path.format({
root: '/',
base: 'file.txt',
- ext: 'ignored'
+ ext: 'ignored',
});
// Returns: '/file.txt'
@@ -256,7 +256,7 @@ path.format({
path.format({
root: '/',
name: 'file',
- ext: '.txt'
+ ext: '.txt',
});
// Returns: '/file.txt'
@@ -264,7 +264,7 @@ path.format({
path.format({
root: '/',
name: 'file',
- ext: 'txt'
+ ext: 'txt',
});
// Returns: '/file.txt'
```
@@ -274,7 +274,7 @@ On Windows:
```js
path.format({
dir: 'C:\\path\\dir',
- base: 'file.txt'
+ base: 'file.txt',
});
// Returns: 'C:\\path\\dir\\file.txt'
```
diff --git a/doc/api/perf_hooks.md b/doc/api/perf_hooks.md
index a996f071133484..f99758a0e75275 100644
--- a/doc/api/perf_hooks.md
+++ b/doc/api/perf_hooks.md
@@ -411,7 +411,7 @@ event type in order for the timing details to be accessed.
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
function someFunction() {
@@ -1201,7 +1201,7 @@ changes:
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const obs = new PerformanceObserver((list, observer) => {
@@ -1267,7 +1267,7 @@ or `options.type`:
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const obs = new PerformanceObserver((list, observer) => {
@@ -1303,7 +1303,7 @@ with respect to `performanceEntry.startTime`.
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const obs = new PerformanceObserver((perfObserverList, observer) => {
@@ -1353,7 +1353,7 @@ equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const obs = new PerformanceObserver((perfObserverList, observer) => {
@@ -1409,7 +1409,7 @@ is equal to `type`.
```js
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const obs = new PerformanceObserver((perfObserverList, observer) => {
@@ -1755,7 +1755,7 @@ to execute the callback).
const async_hooks = require('node:async_hooks');
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const set = new Set();
@@ -1774,7 +1774,7 @@ const hook = async_hooks.createHook({
`Timeout-${id}-Init`,
`Timeout-${id}-Destroy`);
}
- }
+ },
});
hook.enable();
@@ -1800,7 +1800,7 @@ dependencies:
'use strict';
const {
performance,
- PerformanceObserver
+ PerformanceObserver,
} = require('node:perf_hooks');
const mod = require('node:module');
diff --git a/doc/api/process.md b/doc/api/process.md
index 9166194ab54863..31210abf13824e 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -365,7 +365,7 @@ process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,
`Caught exception: ${err}\n` +
- `Exception origin: ${origin}`
+ `Exception origin: ${origin}`,
);
});
@@ -385,7 +385,7 @@ process.on('uncaughtException', (err, origin) => {
fs.writeSync(
process.stderr.fd,
`Caught exception: ${err}\n` +
- `Exception origin: ${origin}`
+ `Exception origin: ${origin}`,
);
});
@@ -1293,7 +1293,7 @@ import { emitWarning } from 'node:process';
// Emit a warning with a code and additional detail.
emitWarning('Something happened!', {
code: 'MY_WARNING',
- detail: 'This is some additional information'
+ detail: 'This is some additional information',
});
// Emits:
// (node:56338) [MY_WARNING] Warning: Something happened!
@@ -1306,7 +1306,7 @@ const { emitWarning } = require('node:process');
// Emit a warning with a code and additional detail.
emitWarning('Something happened!', {
code: 'MY_WARNING',
- detail: 'This is some additional information'
+ detail: 'This is some additional information',
});
// Emits:
// (node:56338) [MY_WARNING] Warning: Something happened!
@@ -3671,7 +3671,7 @@ import { umask } from 'node:process';
const newmask = 0o022;
const oldmask = umask(newmask);
console.log(
- `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`
+ `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,
);
```
@@ -3681,7 +3681,7 @@ const { umask } = require('node:process');
const newmask = 0o022;
const oldmask = umask(newmask);
console.log(
- `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`
+ `Changed umask from ${oldmask.toString(8)} to ${newmask.toString(8)}`,
);
```
diff --git a/doc/api/readline.md b/doc/api/readline.md
index b4ac0b3bf5f264..eaac5f8f79d579 100644
--- a/doc/api/readline.md
+++ b/doc/api/readline.md
@@ -449,7 +449,7 @@ const rl = readline.createInterface(process.stdin);
const showResults = debounce(() => {
console.log(
'\n',
- values.filter((val) => val.startsWith(rl.line)).join(' ')
+ values.filter((val) => val.startsWith(rl.line)).join(' '),
);
}, 300);
process.stdin.on('keypress', (c, k) => {
@@ -707,7 +707,7 @@ instance.
const readlinePromises = require('node:readline/promises');
const rl = readlinePromises.createInterface({
input: process.stdin,
- output: process.stdout
+ output: process.stdout,
});
```
@@ -964,7 +964,7 @@ instance.
const readline = require('node:readline');
const rl = readline.createInterface({
input: process.stdin,
- output: process.stdout
+ output: process.stdout,
});
```
@@ -1103,7 +1103,7 @@ const readline = require('node:readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
- prompt: 'OHAI> '
+ prompt: 'OHAI> ',
});
rl.prompt();
@@ -1139,7 +1139,7 @@ async function processLineByLine() {
const rl = readline.createInterface({
input: fileStream,
- crlfDelay: Infinity
+ crlfDelay: Infinity,
});
// Note: we use the crlfDelay option to recognize all instances of CR LF
// ('\r\n') in input.txt as a single line break.
@@ -1161,7 +1161,7 @@ const readline = require('node:readline');
const rl = readline.createInterface({
input: fs.createReadStream('sample.txt'),
- crlfDelay: Infinity
+ crlfDelay: Infinity,
});
rl.on('line', (line) => {
@@ -1181,7 +1181,7 @@ const { createInterface } = require('node:readline');
try {
const rl = createInterface({
input: createReadStream('big-file.txt'),
- crlfDelay: Infinity
+ crlfDelay: Infinity,
});
rl.on('line', (line) => {
diff --git a/doc/api/repl.md b/doc/api/repl.md
index 28dc5ecce55f51..1d216c4358fcd4 100644
--- a/doc/api/repl.md
+++ b/doc/api/repl.md
@@ -132,7 +132,7 @@ const r = repl.start('> ');
Object.defineProperty(r.context, 'm', {
configurable: false,
enumerable: true,
- value: msg
+ value: msg,
});
```
@@ -485,7 +485,7 @@ replServer.defineCommand('sayhello', {
this.clearBufferedCommand();
console.log(`Hello, ${name}!`);
this.displayPrompt();
- }
+ },
});
replServer.defineCommand('saybye', function saybye() {
console.log('Goodbye!');
@@ -733,7 +733,7 @@ let connections = 0;
repl.start({
prompt: 'Node.js via stdin> ',
input: process.stdin,
- output: process.stdout
+ output: process.stdout,
});
net.createServer((socket) => {
@@ -741,7 +741,7 @@ net.createServer((socket) => {
repl.start({
prompt: 'Node.js via Unix socket> ',
input: socket,
- output: socket
+ output: socket,
}).on('exit', () => {
socket.end();
});
@@ -752,7 +752,7 @@ net.createServer((socket) => {
repl.start({
prompt: 'Node.js via TCP socket> ',
input: socket,
- output: socket
+ output: socket,
}).on('exit', () => {
socket.end();
});
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 224ccbb27be9b3..f861a6b467449a 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -2536,7 +2536,7 @@ pipeline(
} else {
console.log('Pipeline succeeded.');
}
- }
+ },
);
```
@@ -2555,7 +2555,7 @@ async function run() {
await pipeline(
fs.createReadStream('archive.tar'),
zlib.createGzip(),
- fs.createWriteStream('archive.tar.gz')
+ fs.createWriteStream('archive.tar.gz'),
);
console.log('Pipeline succeeded.');
}
@@ -2602,7 +2602,7 @@ async function run() {
yield await processChunk(chunk, { signal });
}
},
- fs.createWriteStream('uppercase.txt')
+ fs.createWriteStream('uppercase.txt'),
);
console.log('Pipeline succeeded.');
}
@@ -2624,7 +2624,7 @@ async function run() {
await someLongRunningfn({ signal });
yield 'asd';
},
- fs.createWriteStream('uppercase.txt')
+ fs.createWriteStream('uppercase.txt'),
);
console.log('Pipeline succeeded.');
}
@@ -2696,7 +2696,7 @@ import { compose, Transform } from 'node:stream';
const removeSpaces = new Transform({
transform(chunk, encoding, callback) {
callback(null, String(chunk).replace(' ', ''));
- }
+ },
});
async function* toUpper(source) {
@@ -2948,7 +2948,7 @@ added: v17.0.0
import { Duplex } from 'node:stream';
import {
ReadableStream,
- WritableStream
+ WritableStream,
} from 'node:stream/web';
const readable = new ReadableStream({
@@ -2960,12 +2960,12 @@ const readable = new ReadableStream({
const writable = new WritableStream({
write(chunk) {
console.log('writable', chunk);
- }
+ },
});
const pair = {
readable,
- writable
+ writable,
};
const duplex = Duplex.fromWeb(pair, { encoding: 'utf8', objectMode: true });
@@ -2980,7 +2980,7 @@ for await (const chunk of duplex) {
const { Duplex } = require('node:stream');
const {
ReadableStream,
- WritableStream
+ WritableStream,
} = require('node:stream/web');
const readable = new ReadableStream({
@@ -2992,12 +2992,12 @@ const readable = new ReadableStream({
const writable = new WritableStream({
write(chunk) {
console.log('writable', chunk);
- }
+ },
});
const pair = {
readable,
- writable
+ writable,
};
const duplex = Duplex.fromWeb(pair, { encoding: 'utf8', objectMode: true });
@@ -3030,7 +3030,7 @@ const duplex = Duplex({
write(chunk, encoding, callback) {
console.log('writable', chunk);
callback();
- }
+ },
});
const { readable, writable } = Duplex.toWeb(duplex);
@@ -3052,7 +3052,7 @@ const duplex = Duplex({
write(chunk, encoding, callback) {
console.log('writable', chunk);
callback();
- }
+ },
});
const { readable, writable } = Duplex.toWeb(duplex);
@@ -3085,7 +3085,7 @@ const fs = require('node:fs');
const controller = new AbortController();
const read = addAbortSignal(
controller.signal,
- fs.createReadStream(('object.json'))
+ fs.createReadStream(('object.json')),
);
// Later, abort the operation closing the stream
controller.abort();
@@ -3098,7 +3098,7 @@ const controller = new AbortController();
setTimeout(() => controller.abort(), 10_000); // set a timeout
const stream = addAbortSignal(
controller.signal,
- fs.createReadStream(('object.json'))
+ fs.createReadStream(('object.json')),
);
(async () => {
try {
@@ -3192,7 +3192,7 @@ const myWritable = new Writable({
},
destroy() {
// Free resources...
- }
+ },
});
```
@@ -3299,7 +3299,7 @@ const myWritable = new Writable({
},
writev(chunks, callback) {
// ...
- }
+ },
});
```
@@ -3318,7 +3318,7 @@ const myWritable = new Writable({
writev(chunks, callback) {
// ...
},
- signal: controller.signal
+ signal: controller.signal,
});
// Later, abort the operation closing the stream
controller.abort();
@@ -3509,7 +3509,7 @@ const myWritable = new Writable({
} else {
callback();
}
- }
+ },
});
```
@@ -3656,7 +3656,7 @@ const { Readable } = require('node:stream');
const myReadable = new Readable({
read(size) {
// ...
- }
+ },
});
```
@@ -3671,7 +3671,7 @@ const read = new Readable({
read(size) {
// ...
},
- signal: controller.signal
+ signal: controller.signal,
});
// Later, abort the operation closing the stream
controller.abort();
@@ -3879,7 +3879,7 @@ const myReadable = new Readable({
} else {
// Do some work.
}
- }
+ },
});
```
@@ -3997,7 +3997,7 @@ const myDuplex = new Duplex({
},
write(chunk, encoding, callback) {
// ...
- }
+ },
});
```
@@ -4029,7 +4029,7 @@ pipeline(
} catch (err) {
callback(err);
}
- }
+ },
}),
fs.createWriteStream('valid-object.json'),
(err) => {
@@ -4038,7 +4038,7 @@ pipeline(
} else {
console.log('completed');
}
- }
+ },
);
```
@@ -4109,7 +4109,7 @@ const myTransform = new Transform({
// Push the data onto the readable queue.
callback(null, '0'.repeat(data.length % 2) + data);
- }
+ },
});
myTransform.setEncoding('ascii');
@@ -4191,7 +4191,7 @@ const { Transform } = require('node:stream');
const myTransform = new Transform({
transform(chunk, encoding, callback) {
// ...
- }
+ },
});
```
diff --git a/doc/api/test.md b/doc/api/test.md
index 3e9d3775f4cabd..4d5c50f51ff8ec 100644
--- a/doc/api/test.md
+++ b/doc/api/test.md
@@ -1103,7 +1103,7 @@ test('top level test', async (t) => {
'This is a subtest',
(t) => {
assert.ok('some relevant assertion here');
- }
+ },
);
});
```
@@ -1137,7 +1137,7 @@ test('top level test', async (t) => {
'This is a subtest',
(t) => {
assert.ok('some relevant assertion here');
- }
+ },
);
});
```
@@ -1314,7 +1314,7 @@ test('top level test', async (t) => {
{ only: false, skip: false, concurrency: 1, todo: false },
(t) => {
assert.ok('some relevant assertion here');
- }
+ },
);
});
```
diff --git a/doc/api/tls.md b/doc/api/tls.md
index d20004e0da4405..db4487d14c73dc 100644
--- a/doc/api/tls.md
+++ b/doc/api/tls.md
@@ -2126,7 +2126,7 @@ const options = {
requestCert: true,
// This is necessary only if the client uses a self-signed certificate.
- ca: [ fs.readFileSync('client-cert.pem') ]
+ ca: [ fs.readFileSync('client-cert.pem') ],
};
const server = tls.createServer(options, (socket) => {
diff --git a/doc/api/url.md b/doc/api/url.md
index 09faddadc2b99d..ba80ec96d3d38b 100644
--- a/doc/api/url.md
+++ b/doc/api/url.md
@@ -762,7 +762,7 @@ joins all array elements with commas.
```js
const params = new URLSearchParams({
user: 'abc',
- query: ['first', 'second']
+ query: ['first', 'second'],
});
console.log(params.getAll('query'));
// Prints [ 'first,second' ]
@@ -1454,8 +1454,8 @@ url.format({
pathname: '/some/path',
query: {
page: 1,
- format: 'json'
- }
+ format: 'json',
+ },
});
// => 'https://example.com/some/path?page=1&format=json'
diff --git a/doc/api/util.md b/doc/api/util.md
index 8377ed61cb8ccd..69549ebd0da993 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -680,7 +680,7 @@ const o = {
'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.',
'test',
'foo']], 4],
- b: new Map([['za', 1], ['zb', 'test']])
+ b: new Map([['za', 1], ['zb', 'test']]),
};
console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 }));
@@ -748,7 +748,7 @@ const assert = require('node:assert');
const o1 = {
b: [2, 3, 1],
a: '`a` comes before `b`',
- c: new Set([2, 3, 1])
+ c: new Set([2, 3, 1]),
};
console.log(inspect(o1, { sorted: true }));
// { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } }
@@ -758,11 +758,11 @@ console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) }));
const o2 = {
c: new Set([2, 1, 3]),
a: '`a` comes before `b`',
- b: [2, 3, 1]
+ b: [2, 3, 1],
};
assert.strict.equal(
inspect(o1, { sorted: true }),
- inspect(o2, { sorted: true })
+ inspect(o2, { sorted: true }),
);
```
@@ -909,7 +909,7 @@ class Box {
}
const newOptions = Object.assign({}, options, {
- depth: options.depth === null ? null : options.depth - 1
+ depth: options.depth === null ? null : options.depth - 1,
});
// Five space padding because that's the size of "Box< ".
@@ -1437,15 +1437,15 @@ const args = ['-f', '--bar', 'b'];
const options = {
foo: {
type: 'boolean',
- short: 'f'
+ short: 'f',
},
bar: {
- type: 'string'
- }
+ type: 'string',
+ },
};
const {
values,
- positionals
+ positionals,
} = parseArgs({ args, options });
console.log(values, positionals);
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
@@ -1457,15 +1457,15 @@ const args = ['-f', '--bar', 'b'];
const options = {
foo: {
type: 'boolean',
- short: 'f'
+ short: 'f',
},
bar: {
- type: 'string'
- }
+ type: 'string',
+ },
};
const {
values,
- positionals
+ positionals,
} = parseArgs({ args, options });
console.log(values, positionals);
// Prints: [Object: null prototype] { foo: true, bar: 'b' } []
diff --git a/doc/api/v8.md b/doc/api/v8.md
index 40d0b10c989337..7bb1a795b5a581 100644
--- a/doc/api/v8.md
+++ b/doc/api/v8.md
@@ -349,7 +349,7 @@ const { writeHeapSnapshot } = require('node:v8');
const {
Worker,
isMainThread,
- parentPort
+ parentPort,
} = require('node:worker_threads');
if (isMainThread) {
@@ -689,7 +689,7 @@ const stopHookSet = promiseHooks.createHook({
init,
settled,
before,
- after
+ after,
});
// To stop a hook, call the function returned at its creation.
@@ -839,7 +839,7 @@ specifics of all functions that can be passed to `callbacks` is in the
import { promiseHooks } from 'node:v8';
const stopAll = promiseHooks.createHook({
- init(promise, parent) {}
+ init(promise, parent) {},
});
```
@@ -847,7 +847,7 @@ const stopAll = promiseHooks.createHook({
const { promiseHooks } = require('node:v8');
const stopAll = promiseHooks.createHook({
- init(promise, parent) {}
+ init(promise, parent) {},
});
```
@@ -950,7 +950,7 @@ const {
isBuildingSnapshot,
addSerializeCallback,
addDeserializeCallback,
- setDeserializeMainFunction
+ setDeserializeMainFunction,
} = require('node:v8').startupSnapshot;
const filePath = path.resolve(__dirname, '../x1024.txt');
diff --git a/doc/api/vm.md b/doc/api/vm.md
index a37dedb6e2fabd..35a5d4f4bafd67 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -206,7 +206,7 @@ const vm = require('node:vm');
const context = {
animal: 'cat',
- count: 2
+ count: 2,
};
const script = new vm.Script('count += 1; name = "kitty";');
@@ -785,7 +785,7 @@ const module = new vm.SourceTextModule(
// Object.prototype in the top context rather than that in
// the contextified object.
meta.prop = {};
- }
+ },
});
// Since module has no dependencies, the linker function will never be called.
await module.link(() => {});
@@ -812,7 +812,7 @@ const contextifiedObject = vm.createContext({ secret: 42 });
// Object.prototype in the top context rather than that in
// the contextified object.
meta.prop = {};
- }
+ },
});
// Since module has no dependencies, the linker function will never be called.
await module.link(() => {});
@@ -1358,7 +1358,7 @@ const vm = require('node:vm');
const contextObject = {
animal: 'cat',
- count: 2
+ count: 2,
};
vm.runInNewContext('count += 1; name = "kitty"', contextObject);
@@ -1522,7 +1522,7 @@ function loop() {
vm.runInNewContext(
'Promise.resolve().then(() => loop());',
{ loop, console },
- { timeout: 5 }
+ { timeout: 5 },
);
// This is printed *before* 'entering loop' (!)
console.log('done executing');
@@ -1541,7 +1541,7 @@ function loop() {
vm.runInNewContext(
'Promise.resolve().then(() => loop());',
{ loop, console },
- { timeout: 5, microtaskMode: 'afterEvaluate' }
+ { timeout: 5, microtaskMode: 'afterEvaluate' },
);
```
diff --git a/doc/api/wasi.md b/doc/api/wasi.md
index 1b457201345ff0..c0b07c63bb3426 100644
--- a/doc/api/wasi.md
+++ b/doc/api/wasi.md
@@ -19,8 +19,8 @@ const wasi = new WASI({
args: argv,
env,
preopens: {
- '/sandbox': '/some/real/path/that/wasm/can/access'
- }
+ '/sandbox': '/some/real/path/that/wasm/can/access',
+ },
});
// Some WASI binaries require:
@@ -28,7 +28,7 @@ const wasi = new WASI({
const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
const wasm = await WebAssembly.compile(
- await readFile(new URL('./demo.wasm', import.meta.url))
+ await readFile(new URL('./demo.wasm', import.meta.url)),
);
const instance = await WebAssembly.instantiate(wasm, importObject);
@@ -46,8 +46,8 @@ const wasi = new WASI({
args: argv,
env,
preopens: {
- '/sandbox': '/some/real/path/that/wasm/can/access'
- }
+ '/sandbox': '/some/real/path/that/wasm/can/access',
+ },
});
// Some WASI binaries require:
@@ -56,7 +56,7 @@ const importObject = { wasi_snapshot_preview1: wasi.wasiImport };
(async () => {
const wasm = await WebAssembly.compile(
- await readFile(join(__dirname, 'demo.wasm'))
+ await readFile(join(__dirname, 'demo.wasm')),
);
const instance = await WebAssembly.instantiate(wasm, importObject);
diff --git a/doc/api/webcrypto.md b/doc/api/webcrypto.md
index 31568ffc3b783a..c993de34e2f8e3 100644
--- a/doc/api/webcrypto.md
+++ b/doc/api/webcrypto.md
@@ -54,14 +54,14 @@ const { subtle } = globalThis.crypto;
const key = await subtle.generateKey({
name: 'HMAC',
hash: 'SHA-256',
- length: 256
+ length: 256,
}, true, ['sign', 'verify']);
const enc = new TextEncoder();
const message = enc.encode('I love cupcakes');
const digest = await subtle.sign({
- name: 'HMAC'
+ name: 'HMAC',
}, key, message);
})();
@@ -82,7 +82,7 @@ const { subtle } = globalThis.crypto;
async function generateAesKey(length = 256) {
const key = await subtle.generateKey({
name: 'AES-CBC',
- length
+ length,
}, true, ['encrypt', 'decrypt']);
return key;
@@ -97,7 +97,7 @@ const { subtle } = globalThis.crypto;
async function generateEcKey(namedCurve = 'P-521') {
const {
publicKey,
- privateKey
+ privateKey,
} = await subtle.generateKey({
name: 'ECDSA',
namedCurve,
@@ -135,7 +135,7 @@ const { subtle } = globalThis.crypto;
async function generateHmacKey(hash = 'SHA-256') {
const key = await subtle.generateKey({
name: 'HMAC',
- hash
+ hash,
}, true, ['sign', 'verify']);
return key;
@@ -151,7 +151,7 @@ const publicExponent = new Uint8Array([1, 0, 1]);
async function generateRsaKey(modulusLength = 2048, hash = 'SHA-256') {
const {
publicKey,
- privateKey
+ privateKey,
} = await subtle.generateKey({
name: 'RSASSA-PKCS1-v1_5',
modulusLength,
@@ -181,7 +181,7 @@ async function aesEncrypt(plaintext) {
return {
key,
iv,
- ciphertext
+ ciphertext,
};
}
@@ -204,7 +204,7 @@ const { subtle } = globalThis.crypto;
async function generateAndExportHmacKey(format = 'jwk', hash = 'SHA-512') {
const key = await subtle.generateKey({
name: 'HMAC',
- hash
+ hash,
}, true, ['sign', 'verify']);
return subtle.exportKey(format, key);
@@ -213,7 +213,7 @@ async function generateAndExportHmacKey(format = 'jwk', hash = 'SHA-512') {
async function importHmacKey(keyData, format = 'jwk', hash = 'SHA-512') {
const key = await subtle.importKey(format, keyData, {
name: 'HMAC',
- hash
+ hash,
}, true, ['sign', 'verify']);
return key;
@@ -231,11 +231,11 @@ async function generateAndWrapHmacKey(format = 'jwk', hash = 'SHA-512') {
wrappingKey,
] = await Promise.all([
subtle.generateKey({
- name: 'HMAC', hash
+ name: 'HMAC', hash,
}, true, ['sign', 'verify']),
subtle.generateKey({
name: 'AES-KW',
- length: 256
+ length: 256,
}, true, ['wrapKey', 'unwrapKey']),
]);
@@ -304,7 +304,7 @@ async function pbkdf2(pass, salt, iterations = 1000, length = 256) {
name: 'PBKDF2',
hash: 'SHA-512',
salt: ec.encode(salt),
- iterations
+ iterations,
}, key, length);
return bits;
}
@@ -321,10 +321,10 @@ async function pbkdf2Key(pass, salt, iterations = 1000, length = 256) {
name: 'PBKDF2',
hash: 'SHA-512',
salt: ec.encode(salt),
- iterations
+ iterations,
}, keyMaterial, {
name: 'AES-GCM',
- length: 256
+ length: 256,
}, true, ['encrypt', 'decrypt']);
return key;
}
diff --git a/doc/api/webstreams.md b/doc/api/webstreams.md
index 970d147be49fe0..c8c2b845c9ad6e 100644
--- a/doc/api/webstreams.md
+++ b/doc/api/webstreams.md
@@ -35,15 +35,15 @@ is used to read the data from the stream.
```mjs
import {
- ReadableStream
+ ReadableStream,
} from 'node:stream/web';
import {
- setInterval as every
+ setInterval as every,
} from 'node:timers/promises';
import {
- performance
+ performance,
} from 'node:perf_hooks';
const SECOND = 1000;
@@ -52,7 +52,7 @@ const stream = new ReadableStream({
async start(controller) {
for await (const _ of every(SECOND))
controller.enqueue(performance.now());
- }
+ },
});
for await (const value of stream)
@@ -61,15 +61,15 @@ for await (const value of stream)
```cjs
const {
- ReadableStream
+ ReadableStream,
} = require('node:stream/web');
const {
- setInterval: every
+ setInterval: every,
} = require('node:timers/promises');
const {
- performance
+ performance,
} = require('node:perf_hooks');
const SECOND = 1000;
@@ -78,7 +78,7 @@ const stream = new ReadableStream({
async start(controller) {
for await (const _ of every(SECOND))
controller.enqueue(performance.now());
- }
+ },
});
(async () => {
@@ -238,7 +238,7 @@ const stream = new ReadableStream({
const transform = new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk.toUpperCase());
- }
+ },
});
const transformedStream = stream.pipeThrough(transform);
@@ -262,7 +262,7 @@ const stream = new ReadableStream({
const transform = new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk.toUpperCase());
- }
+ },
});
const transformedStream = stream.pipeThrough(transform);
@@ -476,11 +476,11 @@ data that avoids extraneous copying.
```mjs
import {
- open
+ open,
} from 'node:fs/promises';
import {
- ReadableStream
+ ReadableStream,
} from 'node:stream/web';
import { Buffer } from 'node:buffer';
@@ -501,7 +501,7 @@ class Source {
} = await this.file.read({
buffer: view,
offset: view.byteOffset,
- length: view.byteLength
+ length: view.byteLength,
});
if (bytesRead === 0) {
@@ -774,13 +774,13 @@ The `WritableStream` is a destination to which stream data is sent.
```mjs
import {
- WritableStream
+ WritableStream,
} from 'node:stream/web';
const stream = new WritableStream({
write(chunk) {
console.log(chunk);
- }
+ },
});
await stream.getWriter().write('Hello World');
@@ -1018,13 +1018,13 @@ queue.
```mjs
import {
- TransformStream
+ TransformStream,
} from 'node:stream/web';
const transform = new TransformStream({
transform(chunk, controller) {
controller.enqueue(chunk.toUpperCase());
- }
+ },
});
await Promise.all([
@@ -1571,11 +1571,11 @@ import { Readable } from 'node:stream';
const items = Array.from(
{
- length: 100
+ length: 100,
},
() => ({
- message: 'hello world from consumers!'
- })
+ message: 'hello world from consumers!',
+ }),
);
const readable = Readable.from(JSON.stringify(items));
@@ -1589,11 +1589,11 @@ const { Readable } = require('node:stream');
const items = Array.from(
{
- length: 100
+ length: 100,
},
() => ({
- message: 'hello world from consumers!'
- })
+ message: 'hello world from consumers!',
+ }),
);
const readable = Readable.from(JSON.stringify(items));
diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md
index 8f71fb5a851972..43f10ae489a9a0 100644
--- a/doc/api/worker_threads.md
+++ b/doc/api/worker_threads.md
@@ -23,14 +23,14 @@ instances.
```js
const {
- Worker, isMainThread, parentPort, workerData
+ Worker, isMainThread, parentPort, workerData,
} = require('node:worker_threads');
if (isMainThread) {
module.exports = function parseJSAsync(script) {
return new Promise((resolve, reject) => {
const worker = new Worker(__filename, {
- workerData: script
+ workerData: script,
});
worker.on('message', resolve);
worker.on('error', reject);
@@ -370,7 +370,7 @@ with all other `BroadcastChannel` instances bound to the same channel name.
const {
isMainThread,
BroadcastChannel,
- Worker
+ Worker,
} = require('node:worker_threads');
const bc = new BroadcastChannel('hello');
@@ -883,7 +883,7 @@ the thread barrier.
```js
const assert = require('node:assert');
const {
- Worker, MessageChannel, MessagePort, isMainThread, parentPort
+ Worker, MessageChannel, MessagePort, isMainThread, parentPort,
} = require('node:worker_threads');
if (isMainThread) {
const worker = new Worker(__filename);
diff --git a/doc/api/zlib.md b/doc/api/zlib.md
index 83a767a07e0253..a33de3833cbe9f 100644
--- a/doc/api/zlib.md
+++ b/doc/api/zlib.md
@@ -26,7 +26,7 @@ const { createGzip } = require('node:zlib');
const { pipeline } = require('node:stream');
const {
createReadStream,
- createWriteStream
+ createWriteStream,
} = require('node:fs');
const gzip = createGzip();
@@ -562,8 +562,8 @@ const stream = zlib.createBrotliCompress({
params: {
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT,
[zlib.constants.BROTLI_PARAM_QUALITY]: 4,
- [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fs.statSync(inputFile).size
- }
+ [zlib.constants.BROTLI_PARAM_SIZE_HINT]: fs.statSync(inputFile).size,
+ },
});
```
diff --git a/doc/api_assets/api.js b/doc/api_assets/api.js
index 8854182c4c56f0..49906b1a2abab5 100644
--- a/doc/api_assets/api.js
+++ b/doc/api_assets/api.js
@@ -20,7 +20,7 @@
function() {
mq.removeEventListener('change', mqChangeListener);
},
- { once: true }
+ { once: true },
);
}
}
@@ -37,7 +37,7 @@
themeToggleButton.addEventListener('click', function() {
sessionStorage.setItem(
kCustomPreference,
- document.documentElement.classList.toggle('dark-mode')
+ document.documentElement.classList.toggle('dark-mode'),
);
});
}
@@ -119,7 +119,7 @@
header.classList.toggle('is-pinned', newStatus);
},
- { threshold: [1] }
+ { threshold: [1] },
).observe(header);
}
diff --git a/doc/changelogs/CHANGELOG_V12.md b/doc/changelogs/CHANGELOG_V12.md
index faf4839c446cae..4c67234eb747e7 100644
--- a/doc/changelogs/CHANGELOG_V12.md
+++ b/doc/changelogs/CHANGELOG_V12.md
@@ -1821,7 +1821,7 @@ const { Console } = require('console');
const customConsole = new Console({
stdout: process.stdout,
stderr: process.stderr,
- groupIndentation: 10
+ groupIndentation: 10,
});
customConsole.log('foo');
diff --git a/doc/changelogs/CHANGELOG_V14.md b/doc/changelogs/CHANGELOG_V14.md
index 69783f7c19f3d4..3c2c087e64a9e3 100644
--- a/doc/changelogs/CHANGELOG_V14.md
+++ b/doc/changelogs/CHANGELOG_V14.md
@@ -3971,7 +3971,7 @@ const { Console } = require('console');
const customConsole = new Console({
stdout: process.stdout,
stderr: process.stderr,
- groupIndentation: 10
+ groupIndentation: 10,
});
customConsole.log('foo');
diff --git a/doc/changelogs/CHANGELOG_V15.md b/doc/changelogs/CHANGELOG_V15.md
index 2a1e91e52be666..983a09c43f7ef6 100644
--- a/doc/changelogs/CHANGELOG_V15.md
+++ b/doc/changelogs/CHANGELOG_V15.md
@@ -1078,7 +1078,7 @@ const read = new Readable({
read(size) {
// ...
},
- signal: controller.signal
+ signal: controller.signal,
});
// Later, abort the operation closing the stream
controller.abort();
diff --git a/doc/contributing/primordials.md b/doc/contributing/primordials.md
index 48f260559f0c39..5570a17f6bc5bc 100644
--- a/doc/contributing/primordials.md
+++ b/doc/contributing/primordials.md
@@ -516,7 +516,7 @@ Promise.prototype.then = function then(a, b) {
let thenBlockExecuted = false;
PromisePrototypeThen(
PromiseAll(new SafeArrayIterator([PromiseResolve()])),
- () => { thenBlockExecuted = true; }
+ () => { thenBlockExecuted = true; },
);
process.on('exit', () => console.log(thenBlockExecuted)); // false
```
@@ -531,7 +531,7 @@ Promise.prototype.then = function then(a, b) {
let thenBlockExecuted = false;
PromisePrototypeThen(
SafePromiseAll([PromiseResolve()]),
- () => { thenBlockExecuted = true; }
+ () => { thenBlockExecuted = true; },
);
process.on('exit', () => console.log(thenBlockExecuted)); // true
```
diff --git a/doc/contributing/using-internal-errors.md b/doc/contributing/using-internal-errors.md
index b55b187bff0152..6e88ca9863f5a0 100644
--- a/doc/contributing/using-internal-errors.md
+++ b/doc/contributing/using-internal-errors.md
@@ -122,7 +122,7 @@ assert.throws(() => {
socket.bind();
}, common.expectsError({
code: 'ERR_SOCKET_ALREADY_BOUND',
- type: Error
+ type: Error,
}));
```
diff --git a/doc/contributing/writing-and-running-benchmarks.md b/doc/contributing/writing-and-running-benchmarks.md
index 99325d876928b3..9422d42519453c 100644
--- a/doc/contributing/writing-and-running-benchmarks.md
+++ b/doc/contributing/writing-and-running-benchmarks.md
@@ -486,12 +486,12 @@ const configs = {
// Most benchmarks just use one value for all runs.
n: [1024],
type: ['fast', 'slow'], // Custom configurations
- size: [16, 128, 1024] // Custom configurations
+ size: [16, 128, 1024], // Custom configurations
};
const options = {
// Add --expose-internals in order to require internal modules in main
- flags: ['--zero-fill-buffers']
+ flags: ['--zero-fill-buffers'],
};
// `main` and `configs` are required, `options` is optional.
@@ -535,7 +535,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
kb: [64, 128, 256, 1024],
connections: [100, 500],
- duration: 5
+ duration: 5,
});
function main(conf) {
diff --git a/doc/contributing/writing-tests.md b/doc/contributing/writing-tests.md
index cc75191d32027e..dc4954fe9a874f 100644
--- a/doc/contributing/writing-tests.md
+++ b/doc/contributing/writing-tests.md
@@ -46,7 +46,7 @@ const server = http.createServer(common.mustCall((req, res) => { // 11
server.listen(0, () => { // 14
http.get({ // 15
port: server.address().port, // 16
- headers: { 'Test': 'Düsseldorf' } // 17
+ headers: { 'Test': 'Düsseldorf' }, // 17
}, common.mustCall((res) => { // 18
assert.strictEqual(res.statusCode, 200); // 19
server.close(); // 20
@@ -116,7 +116,7 @@ const server = http.createServer(common.mustCall((req, res) => {
server.listen(0, () => {
http.get({
port: server.address().port,
- headers: { 'Test': 'Düsseldorf' }
+ headers: { 'Test': 'Düsseldorf' },
}, common.mustCall((res) => {
assert.strictEqual(res.statusCode, 200);
server.close();
@@ -192,7 +192,7 @@ const server = http.createServer((req, res) => {
listening++;
const options = {
agent: null,
- port: server.address().port
+ port: server.address().port,
};
http.get(options, (res) => {
response++;
@@ -214,7 +214,7 @@ const server = http.createServer(common.mustCall((req, res) => {
})).listen(0, common.mustCall(() => {
const options = {
agent: null,
- port: server.address().port
+ port: server.address().port,
};
http.get(options, common.mustCall((res) => {
res.resume();
@@ -262,7 +262,7 @@ const fs = require('node:fs').promises;
// Wrap the `onFulfilled` handler in `common.mustCall()`.
fs.readFile('test-file').then(
common.mustCall(
- (content) => assert.strictEqual(content.toString(), 'test2')
+ (content) => assert.strictEqual(content.toString(), 'test2'),
));
```
@@ -308,7 +308,7 @@ assert.throws(
() => {
throw new Error('Wrong value');
},
- /^Error: Wrong value$/ // Instead of something like /Wrong value/
+ /^Error: Wrong value$/, // Instead of something like /Wrong value/
);
```
@@ -319,7 +319,7 @@ assert.throws(
() => {
throw new ERR_FS_FILE_TOO_LARGE(`${sizeKiB} Kb`);
},
- { code: 'ERR_FS_FILE_TOO_LARGE' }
+ { code: 'ERR_FS_FILE_TOO_LARGE' },
// Do not include message: /^File size ([0-9]+ Kb) is greater than 2 GiB$/
);
```