;
/**
diff --git a/node_modules/@actions/io/lib/io-util.js b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js
similarity index 87%
rename from node_modules/@actions/io/lib/io-util.js
rename to node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js
index aae903c..f12e5b0 100644
--- a/node_modules/@actions/io/lib/io-util.js
+++ b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js
@@ -29,11 +29,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
-exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
+exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
-_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
+_a = fs.promises
+// export const {open} = 'fs'
+, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
+// export const {open} = 'fs'
exports.IS_WINDOWS = process.platform === 'win32';
+// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
+exports.UV_FS_O_EXLOCK = 0x10000000;
+exports.READONLY = fs.constants.O_RDONLY;
function exists(fsPath) {
return __awaiter(this, void 0, void 0, function* () {
try {
diff --git a/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js.map b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js.map
new file mode 100644
index 0000000..9a587b3
--- /dev/null
+++ b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io-util.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"io-util.js","sourceRoot":"","sources":["../src/io-util.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AACxB,2CAA4B;AAEf,KAcT,EAAE,CAAC,QAAQ;AACf,6BAA6B;EAd3B,aAAK,aACL,gBAAQ,gBACR,aAAK,aACL,aAAK,aACL,YAAI,YACJ,eAAO,eACP,gBAAQ,gBACR,cAAM,cACN,UAAE,UACF,aAAK,aACL,YAAI,YACJ,eAAO,eACP,cAAM,aACO;AACf,6BAA6B;AAChB,QAAA,UAAU,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAA;AACtD,iHAAiH;AACpG,QAAA,cAAc,GAAG,UAAU,CAAA;AAC3B,QAAA,QAAQ,GAAG,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAA;AAE7C,SAAsB,MAAM,CAAC,MAAc;;QACzC,IAAI;YACF,MAAM,YAAI,CAAC,MAAM,CAAC,CAAA;SACnB;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,OAAO,KAAK,CAAA;aACb;YAED,MAAM,GAAG,CAAA;SACV;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CAAA;AAZD,wBAYC;AAED,SAAsB,WAAW,CAC/B,MAAc,EACd,OAAO,GAAG,KAAK;;QAEf,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,MAAM,YAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,aAAK,CAAC,MAAM,CAAC,CAAA;QAChE,OAAO,KAAK,CAAC,WAAW,EAAE,CAAA;IAC5B,CAAC;CAAA;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,QAAQ,CAAC,CAAS;IAChC,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAA;IAC1B,IAAI,CAAC,CAAC,EAAE;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;KAC5D;IAED,IAAI,kBAAU,EAAE;QACd,OAAO,CACL,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,8BAA8B;SACxE,CAAA,CAAC,sBAAsB;KACzB;IAED,OAAO,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AAbD,4BAaC;AAED;;;;;GAKG;AACH,SAAsB,oBAAoB,CACxC,QAAgB,EAChB,UAAoB;;QAEpB,IAAI,KAAK,GAAyB,SAAS,CAAA;QAC3C,IAAI;YACF,mBAAmB;YACnB,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;SAC7B;QAAC,OAAO,GAAG,EAAE;YACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;gBACzB,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;aACF;SACF;QACD,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;YAC3B,IAAI,kBAAU,EAAE;gBACd,uCAAuC;gBACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;gBACrD,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,KAAK,QAAQ,CAAC,EAAE;oBACpE,OAAO,QAAQ,CAAA;iBAChB;aACF;iBAAM;gBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;oBAC3B,OAAO,QAAQ,CAAA;iBAChB;aACF;SACF;QAED,qBAAqB;QACrB,MAAM,gBAAgB,GAAG,QAAQ,CAAA;QACjC,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,QAAQ,GAAG,gBAAgB,GAAG,SAAS,CAAA;YAEvC,KAAK,GAAG,SAAS,CAAA;YACjB,IAAI;gBACF,KAAK,GAAG,MAAM,YAAI,CAAC,QAAQ,CAAC,CAAA;aAC7B;YAAC,OAAO,GAAG,EAAE;gBACZ,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;oBACzB,sCAAsC;oBACtC,OAAO,CAAC,GAAG,CACT,uEAAuE,QAAQ,MAAM,GAAG,EAAE,CAC3F,CAAA;iBACF;aACF;YAED,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE;gBAC3B,IAAI,kBAAU,EAAE;oBACd,yEAAyE;oBACzE,IAAI;wBACF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;wBACxC,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAA;wBACvD,KAAK,MAAM,UAAU,IAAI,MAAM,eAAO,CAAC,SAAS,CAAC,EAAE;4BACjD,IAAI,SAAS,KAAK,UAAU,CAAC,WAAW,EAAE,EAAE;gCAC1C,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;gCAC3C,MAAK;6BACN;yBACF;qBACF;oBAAC,OAAO,GAAG,EAAE;wBACZ,sCAAsC;wBACtC,OAAO,CAAC,GAAG,CACT,yEAAyE,QAAQ,MAAM,GAAG,EAAE,CAC7F,CAAA;qBACF;oBAED,OAAO,QAAQ,CAAA;iBAChB;qBAAM;oBACL,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;wBAC3B,OAAO,QAAQ,CAAA;qBAChB;iBACF;aACF;SACF;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA5ED,oDA4EC;AAED,SAAS,mBAAmB,CAAC,CAAS;IACpC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAA;IACX,IAAI,kBAAU,EAAE;QACd,6BAA6B;QAC7B,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;QAE1B,2BAA2B;QAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;KACjC;IAED,2BAA2B;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAA;AACjC,CAAC;AAED,qCAAqC;AACrC,6BAA6B;AAC7B,6BAA6B;AAC7B,SAAS,gBAAgB,CAAC,KAAe;IACvC,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC;QACpB,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC;QACxD,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAC1D,CAAA;AACH,CAAC;AAED,qCAAqC;AACrC,SAAgB,UAAU;;IACxB,aAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,mCAAI,SAAS,CAAA;AAC5C,CAAC;AAFD,gCAEC"}
\ No newline at end of file
diff --git a/node_modules/@actions/io/lib/io.d.ts b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.d.ts
similarity index 100%
rename from node_modules/@actions/io/lib/io.d.ts
rename to node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.d.ts
diff --git a/node_modules/@actions/io/lib/io.js b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js
similarity index 83%
rename from node_modules/@actions/io/lib/io.js
rename to node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js
index 4dc1fc3..15f7d7c 100644
--- a/node_modules/@actions/io/lib/io.js
+++ b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js
@@ -30,12 +30,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
const assert_1 = require("assert");
-const childProcess = __importStar(require("child_process"));
const path = __importStar(require("path"));
-const util_1 = require("util");
const ioUtil = __importStar(require("./io-util"));
-const exec = util_1.promisify(childProcess.exec);
-const execFile = util_1.promisify(childProcess.execFile);
/**
* Copies a file or folder.
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
@@ -116,61 +112,23 @@ exports.mv = mv;
function rmRF(inputPath) {
return __awaiter(this, void 0, void 0, function* () {
if (ioUtil.IS_WINDOWS) {
- // Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
- // program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
// Check for invalid characters
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
if (/[*"<>|]/.test(inputPath)) {
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
}
- try {
- const cmdPath = ioUtil.getCmdPath();
- if (yield ioUtil.isDirectory(inputPath, true)) {
- yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
- env: { inputPath }
- });
- }
- else {
- yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
- env: { inputPath }
- });
- }
- }
- catch (err) {
- // if you try to delete a file that doesn't exist, desired result is achieved
- // other errors are valid
- if (err.code !== 'ENOENT')
- throw err;
- }
- // Shelling out fails to remove a symlink folder with missing source, this unlink catches that
- try {
- yield ioUtil.unlink(inputPath);
- }
- catch (err) {
- // if you try to delete a file that doesn't exist, desired result is achieved
- // other errors are valid
- if (err.code !== 'ENOENT')
- throw err;
- }
}
- else {
- let isDir = false;
- try {
- isDir = yield ioUtil.isDirectory(inputPath);
- }
- catch (err) {
- // if you try to delete a file that doesn't exist, desired result is achieved
- // other errors are valid
- if (err.code !== 'ENOENT')
- throw err;
- return;
- }
- if (isDir) {
- yield execFile(`rm`, [`-rf`, `${inputPath}`]);
- }
- else {
- yield ioUtil.unlink(inputPath);
- }
+ try {
+ // note if path does not exist, error is silent
+ yield ioUtil.rm(inputPath, {
+ force: true,
+ maxRetries: 3,
+ recursive: true,
+ retryDelay: 300
+ });
+ }
+ catch (err) {
+ throw new Error(`File was unable to be removed ${err}`);
}
});
}
diff --git a/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js.map b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js.map
new file mode 100644
index 0000000..4021d28
--- /dev/null
+++ b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/lib/io.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"io.js","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAyB;AACzB,2CAA4B;AAC5B,kDAAmC;AAsBnC;;;;;;;GAOG;AACH,SAAsB,EAAE,CACtB,MAAc,EACd,IAAY,EACZ,UAAuB,EAAE;;QAEzB,MAAM,EAAC,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAC,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAExE,MAAM,QAAQ,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC7E,4CAA4C;QAC5C,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE;YAC3C,OAAM;SACP;QAED,wDAAwD;QACxD,MAAM,OAAO,GACX,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,IAAI,mBAAmB;YACvD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACxC,CAAC,CAAC,IAAI,CAAA;QAEV,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE;YAClC,MAAM,IAAI,KAAK,CAAC,8BAA8B,MAAM,EAAE,CAAC,CAAA;SACxD;QACD,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;QAE5C,IAAI,UAAU,CAAC,WAAW,EAAE,EAAE;YAC5B,IAAI,CAAC,SAAS,EAAE;gBACd,MAAM,IAAI,KAAK,CACb,mBAAmB,MAAM,4DAA4D,CACtF,CAAA;aACF;iBAAM;gBACL,MAAM,cAAc,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;aAChD;SACF;aAAM;YACL,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,EAAE,EAAE;gBACzC,oCAAoC;gBACpC,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,UAAU,MAAM,qBAAqB,CAAC,CAAA;aAClE;YAED,MAAM,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC,CAAA;SACvC;IACH,CAAC;CAAA;AAxCD,gBAwCC;AAED;;;;;;GAMG;AACH,SAAsB,EAAE,CACtB,MAAc,EACd,IAAY,EACZ,UAAuB,EAAE;;QAEzB,IAAI,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAC7B,IAAI,UAAU,GAAG,IAAI,CAAA;YACrB,IAAI,MAAM,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;gBAClC,0CAA0C;gBAC1C,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAA;gBAC7C,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;aACvC;YAED,IAAI,UAAU,EAAE;gBACd,IAAI,OAAO,CAAC,KAAK,IAAI,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE;oBAC1C,MAAM,IAAI,CAAC,IAAI,CAAC,CAAA;iBACjB;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;iBAC9C;aACF;SACF;QACD,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAA;QAChC,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IACnC,CAAC;CAAA;AAvBD,gBAuBC;AAED;;;;GAIG;AACH,SAAsB,IAAI,CAAC,SAAiB;;QAC1C,IAAI,MAAM,CAAC,UAAU,EAAE;YACrB,+BAA+B;YAC/B,sEAAsE;YACtE,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBAC7B,MAAM,IAAI,KAAK,CACb,iEAAiE,CAClE,CAAA;aACF;SACF;QACD,IAAI;YACF,+CAA+C;YAC/C,MAAM,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE;gBACzB,KAAK,EAAE,IAAI;gBACX,UAAU,EAAE,CAAC;gBACb,SAAS,EAAE,IAAI;gBACf,UAAU,EAAE,GAAG;aAChB,CAAC,CAAA;SACH;QAAC,OAAO,GAAG,EAAE;YACZ,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,EAAE,CAAC,CAAA;SACxD;IACH,CAAC;CAAA;AArBD,oBAqBC;AAED;;;;;;GAMG;AACH,SAAsB,MAAM,CAAC,MAAc;;QACzC,WAAE,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAA;QAC9C,MAAM,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAC/C,CAAC;CAAA;AAHD,wBAGC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAC,IAAY,EAAE,KAAe;;QACvD,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;SAChD;QAED,4BAA4B;QAC5B,IAAI,KAAK,EAAE;YACT,MAAM,MAAM,GAAW,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;YAE/C,IAAI,CAAC,MAAM,EAAE;gBACX,IAAI,MAAM,CAAC,UAAU,EAAE;oBACrB,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,wMAAwM,CAClP,CAAA;iBACF;qBAAM;oBACL,MAAM,IAAI,KAAK,CACb,qCAAqC,IAAI,gMAAgM,CAC1O,CAAA;iBACF;aACF;YAED,OAAO,MAAM,CAAA;SACd;QAED,MAAM,OAAO,GAAa,MAAM,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhD,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE;YACjC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAA;SAClB;QAED,OAAO,EAAE,CAAA;IACX,CAAC;CAAA;AA/BD,sBA+BC;AAED;;;;GAIG;AACH,SAAsB,UAAU,CAAC,IAAY;;QAC3C,IAAI,CAAC,IAAI,EAAE;YACT,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;SAChD;QAED,sCAAsC;QACtC,MAAM,UAAU,GAAa,EAAE,CAAA;QAC/B,IAAI,MAAM,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;YAC/C,KAAK,MAAM,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBACpE,IAAI,SAAS,EAAE;oBACb,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;iBAC3B;aACF;SACF;QAED,+DAA+D;QAC/D,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;YACzB,MAAM,QAAQ,GAAW,MAAM,MAAM,CAAC,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;YAE5E,IAAI,QAAQ,EAAE;gBACZ,OAAO,CAAC,QAAQ,CAAC,CAAA;aAClB;YAED,OAAO,EAAE,CAAA;SACV;QAED,uCAAuC;QACvC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;YAC3B,OAAO,EAAE,CAAA;SACV;QAED,gCAAgC;QAChC,EAAE;QACF,iGAAiG;QACjG,+FAA+F;QAC/F,iGAAiG;QACjG,oBAAoB;QACpB,MAAM,WAAW,GAAa,EAAE,CAAA;QAEhC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE;YACpB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE;gBACtD,IAAI,CAAC,EAAE;oBACL,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;iBACpB;aACF;SACF;QAED,mBAAmB;QACnB,MAAM,OAAO,GAAa,EAAE,CAAA;QAE5B,KAAK,MAAM,SAAS,IAAI,WAAW,EAAE;YACnC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAChD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAC1B,UAAU,CACX,CAAA;YACD,IAAI,QAAQ,EAAE;gBACZ,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;aACvB;SACF;QAED,OAAO,OAAO,CAAA;IAChB,CAAC;CAAA;AA7DD,gCA6DC;AAED,SAAS,eAAe,CAAC,OAAoB;IAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAA;IAC1D,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;IAC5C,MAAM,mBAAmB,GACvB,OAAO,CAAC,mBAAmB,IAAI,IAAI;QACjC,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAA;IAC1C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAC,CAAA;AAChD,CAAC;AAED,SAAe,cAAc,CAC3B,SAAiB,EACjB,OAAe,EACf,YAAoB,EACpB,KAAc;;QAEd,gDAAgD;QAChD,IAAI,YAAY,IAAI,GAAG;YAAE,OAAM;QAC/B,YAAY,EAAE,CAAA;QAEd,MAAM,MAAM,CAAC,OAAO,CAAC,CAAA;QAErB,MAAM,KAAK,GAAa,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAEvD,KAAK,MAAM,QAAQ,IAAI,KAAK,EAAE;YAC5B,MAAM,OAAO,GAAG,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAA;YAC1C,MAAM,QAAQ,GAAG,GAAG,OAAO,IAAI,QAAQ,EAAE,CAAA;YACzC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;YAE/C,IAAI,WAAW,CAAC,WAAW,EAAE,EAAE;gBAC7B,UAAU;gBACV,MAAM,cAAc,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,KAAK,CAAC,CAAA;aAC7D;iBAAM;gBACL,MAAM,QAAQ,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA;aACzC;SACF;QAED,kDAAkD;QAClD,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IAClE,CAAC;CAAA;AAED,qBAAqB;AACrB,SAAe,QAAQ,CACrB,OAAe,EACf,QAAgB,EAChB,KAAc;;QAEd,IAAI,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,EAAE,EAAE;YAClD,oBAAoB;YACpB,IAAI;gBACF,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;gBAC5B,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;aAC9B;YAAC,OAAO,CAAC,EAAE;gBACV,kCAAkC;gBAClC,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE;oBACtB,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;oBACpC,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;iBAC9B;gBACD,iDAAiD;aAClD;YAED,oBAAoB;YACpB,MAAM,WAAW,GAAW,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC1D,MAAM,MAAM,CAAC,OAAO,CAClB,WAAW,EACX,QAAQ,EACR,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACtC,CAAA;SACF;aAAM,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,IAAI,KAAK,EAAE;YACpD,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;SACzC;IACH,CAAC;CAAA"}
\ No newline at end of file
diff --git a/node_modules/@actions/io/package.json b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/package.json
similarity index 97%
rename from node_modules/@actions/io/package.json
rename to node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/package.json
index 5ebc63a..e8c8d8f 100644
--- a/node_modules/@actions/io/package.json
+++ b/node_modules/.deno/@actions+io@1.1.3/node_modules/@actions/io/package.json
@@ -1,6 +1,6 @@
{
"name": "@actions/io",
- "version": "1.1.2",
+ "version": "1.1.3",
"description": "Actions io lib",
"keywords": [
"github",
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/.initialized b/node_modules/.deno/@actions+tool-cache@2.0.1/.initialized
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/core b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/core
new file mode 120000
index 0000000..9961111
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/core
@@ -0,0 +1 @@
+../../../@actions+core@1.10.1/node_modules/@actions/core
\ No newline at end of file
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/exec b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/exec
new file mode 120000
index 0000000..aa75ad2
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/exec
@@ -0,0 +1 @@
+../../../@actions+exec@1.1.1/node_modules/@actions/exec
\ No newline at end of file
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/http-client b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/http-client
new file mode 120000
index 0000000..ccfba50
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/http-client
@@ -0,0 +1 @@
+../../../@actions+http-client@2.2.3/node_modules/@actions/http-client
\ No newline at end of file
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/io b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/io
new file mode 120000
index 0000000..aa80d32
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/io
@@ -0,0 +1 @@
+../../../@actions+io@1.1.3/node_modules/@actions/io
\ No newline at end of file
diff --git a/node_modules/@actions/tool-cache/LICENSE.md b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/LICENSE.md
similarity index 100%
rename from node_modules/@actions/tool-cache/LICENSE.md
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/LICENSE.md
diff --git a/node_modules/@actions/tool-cache/README.md b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/README.md
similarity index 100%
rename from node_modules/@actions/tool-cache/README.md
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/README.md
diff --git a/node_modules/@actions/tool-cache/lib/manifest.d.ts b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.d.ts
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/manifest.d.ts
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.d.ts
diff --git a/node_modules/@actions/tool-cache/lib/manifest.js b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.js
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/manifest.js
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.js
diff --git a/node_modules/@actions/tool-cache/lib/manifest.js.map b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.js.map
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/manifest.js.map
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/manifest.js.map
diff --git a/node_modules/@actions/tool-cache/lib/retry-helper.d.ts b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.d.ts
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/retry-helper.d.ts
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.d.ts
diff --git a/node_modules/@actions/tool-cache/lib/retry-helper.js b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.js
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/retry-helper.js
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.js
diff --git a/node_modules/@actions/tool-cache/lib/retry-helper.js.map b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.js.map
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/retry-helper.js.map
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/retry-helper.js.map
diff --git a/node_modules/@actions/tool-cache/lib/tool-cache.d.ts b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.d.ts
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/tool-cache.d.ts
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.d.ts
diff --git a/node_modules/@actions/tool-cache/lib/tool-cache.js b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.js
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/tool-cache.js
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.js
diff --git a/node_modules/@actions/tool-cache/lib/tool-cache.js.map b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.js.map
similarity index 100%
rename from node_modules/@actions/tool-cache/lib/tool-cache.js.map
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/lib/tool-cache.js.map
diff --git a/node_modules/@actions/tool-cache/package.json b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/package.json
similarity index 100%
rename from node_modules/@actions/tool-cache/package.json
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/package.json
diff --git a/node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1 b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
similarity index 100%
rename from node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/scripts/Invoke-7zdec.ps1
diff --git a/node_modules/@actions/tool-cache/scripts/externals/7zdec.exe b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
similarity index 100%
rename from node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
rename to node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/@actions/tool-cache/scripts/externals/7zdec.exe
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/semver b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/semver
new file mode 120000
index 0000000..582bffa
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/semver
@@ -0,0 +1 @@
+../../semver@6.3.1/node_modules/semver
\ No newline at end of file
diff --git a/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/uuid b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/uuid
new file mode 120000
index 0000000..7a67bfb
--- /dev/null
+++ b/node_modules/.deno/@actions+tool-cache@2.0.1/node_modules/uuid
@@ -0,0 +1 @@
+../../uuid@3.4.0/node_modules/uuid
\ No newline at end of file
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/.initialized b/node_modules/.deno/@fastify+busboy@2.1.1/.initialized
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/busboy/LICENSE b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/LICENSE
similarity index 100%
rename from node_modules/busboy/LICENSE
rename to node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/LICENSE
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/README.md b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/README.md
new file mode 100644
index 0000000..ece3cc8
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/README.md
@@ -0,0 +1,271 @@
+# busboy
+
+
+
+[![Build Status](https://github.com/fastify/busboy/actions/workflows/ci.yml/badge.svg)](https://github.com/fastify/busboy/actions)
+[![Coverage Status](https://coveralls.io/repos/fastify/busboy/badge.svg?branch=master)](https://coveralls.io/r/fastify/busboy?branch=master)
+[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
+[![Security Responsible Disclosure](https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg)](https://github.com/fastify/.github/blob/main/SECURITY.md)
+
+
+
+
+
+[![NPM version](https://img.shields.io/npm/v/@fastify/busboy.svg?style=flat)](https://www.npmjs.com/package/@fastify/busboy)
+[![NPM downloads](https://img.shields.io/npm/dm/@fastify/busboy.svg?style=flat)](https://www.npmjs.com/package/@fastify/busboy)
+
+
+
+Description
+===========
+
+A Node.js module for parsing incoming HTML form data.
+
+This is an officially supported fork by [fastify](https://github.com/fastify/) organization of the amazing library [originally created](https://github.com/mscdex/busboy) by Brian White,
+aimed at addressing long-standing issues with it.
+
+Benchmark (Mean time for 500 Kb payload, 2000 cycles, 1000 cycle warmup):
+
+| Library | Version | Mean time in nanoseconds (less is better) |
+|-----------------------|---------|-------------------------------------------|
+| busboy | 0.3.1 | `340114` |
+| @fastify/busboy | 1.0.0 | `270984` |
+
+[Changelog](https://github.com/fastify/busboy/blob/master/CHANGELOG.md) since busboy 0.31.
+
+Requirements
+============
+
+* [Node.js](http://nodejs.org/) 10+
+
+
+Install
+=======
+
+ npm i @fastify/busboy
+
+
+Examples
+========
+
+* Parsing (multipart) with default options:
+
+```javascript
+const http = require('node:http');
+const { inspect } = require('node:util');
+const Busboy = require('busboy');
+
+http.createServer((req, res) => {
+ if (req.method === 'POST') {
+ const busboy = new Busboy({ headers: req.headers });
+ busboy.on('file', (fieldname, file, filename, encoding, mimetype) => {
+ console.log(`File [${fieldname}]: filename: ${filename}, encoding: ${encoding}, mimetype: ${mimetype}`);
+ file.on('data', data => {
+ console.log(`File [${fieldname}] got ${data.length} bytes`);
+ });
+ file.on('end', () => {
+ console.log(`File [${fieldname}] Finished`);
+ });
+ });
+ busboy.on('field', (fieldname, val, fieldnameTruncated, valTruncated, encoding, mimetype) => {
+ console.log(`Field [${fieldname}]: value: ${inspect(val)}`);
+ });
+ busboy.on('finish', () => {
+ console.log('Done parsing form!');
+ res.writeHead(303, { Connection: 'close', Location: '/' });
+ res.end();
+ });
+ req.pipe(busboy);
+ } else if (req.method === 'GET') {
+ res.writeHead(200, { Connection: 'close' });
+ res.end(`
+
+ `);
+ }
+}).listen(8000, () => {
+ console.log('Listening for requests');
+});
+
+// Example output, using http://nodejs.org/images/ryan-speaker.jpg as the file:
+//
+// Listening for requests
+// File [filefield]: filename: ryan-speaker.jpg, encoding: binary
+// File [filefield] got 11971 bytes
+// Field [textfield]: value: 'testing! :-)'
+// File [filefield] Finished
+// Done parsing form!
+```
+
+* Save all incoming files to disk:
+
+```javascript
+const http = require('node:http');
+const path = require('node:path');
+const os = require('node:os');
+const fs = require('node:fs');
+
+const Busboy = require('busboy');
+
+http.createServer(function(req, res) {
+ if (req.method === 'POST') {
+ const busboy = new Busboy({ headers: req.headers });
+ busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
+ var saveTo = path.join(os.tmpdir(), path.basename(fieldname));
+ file.pipe(fs.createWriteStream(saveTo));
+ });
+ busboy.on('finish', function() {
+ res.writeHead(200, { 'Connection': 'close' });
+ res.end("That's all folks!");
+ });
+ return req.pipe(busboy);
+ }
+ res.writeHead(404);
+ res.end();
+}).listen(8000, function() {
+ console.log('Listening for requests');
+});
+```
+
+* Parsing (urlencoded) with default options:
+
+```javascript
+const http = require('node:http');
+const { inspect } = require('node:util');
+
+const Busboy = require('busboy');
+
+http.createServer(function(req, res) {
+ if (req.method === 'POST') {
+ const busboy = new Busboy({ headers: req.headers });
+ busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
+ console.log('File [' + fieldname + ']: filename: ' + filename);
+ file.on('data', function(data) {
+ console.log('File [' + fieldname + '] got ' + data.length + ' bytes');
+ });
+ file.on('end', function() {
+ console.log('File [' + fieldname + '] Finished');
+ });
+ });
+ busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated) {
+ console.log('Field [' + fieldname + ']: value: ' + inspect(val));
+ });
+ busboy.on('finish', function() {
+ console.log('Done parsing form!');
+ res.writeHead(303, { Connection: 'close', Location: '/' });
+ res.end();
+ });
+ req.pipe(busboy);
+ } else if (req.method === 'GET') {
+ res.writeHead(200, { Connection: 'close' });
+ res.end('\
+ \
+ ');
+ }
+}).listen(8000, function() {
+ console.log('Listening for requests');
+});
+
+// Example output:
+//
+// Listening for requests
+// Field [textfield]: value: 'testing! :-)'
+// Field [selectfield]: value: '9001'
+// Field [checkfield]: value: 'on'
+// Done parsing form!
+```
+
+
+API
+===
+
+_Busboy_ is a _Writable_ stream
+
+Busboy (special) events
+-----------------------
+
+* **file**(< _string_ >fieldname, < _ReadableStream_ >stream, < _string_ >filename, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new file form field found. `transferEncoding` contains the 'Content-Transfer-Encoding' value for the file stream. `mimeType` contains the 'Content-Type' value for the file stream.
+ * Note: if you listen for this event, you should always handle the `stream` no matter if you care about the file contents or not (e.g. you can simply just do `stream.resume();` if you want to discard the contents), otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any** incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically and safely discarded (these discarded files do still count towards `files` and `parts` limits).
+ * If a configured file size limit was reached, `stream` will both have a boolean property `truncated` (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.
+ * The property `bytesRead` informs about the number of bytes that have been read so far.
+
+* **field**(< _string_ >fieldname, < _string_ >value, < _boolean_ >fieldnameTruncated, < _boolean_ >valueTruncated, < _string_ >transferEncoding, < _string_ >mimeType) - Emitted for each new non-file field found.
+
+* **partsLimit**() - Emitted when specified `parts` limit has been reached. No more 'file' or 'field' events will be emitted.
+
+* **filesLimit**() - Emitted when specified `files` limit has been reached. No more 'file' events will be emitted.
+
+* **fieldsLimit**() - Emitted when specified `fields` limit has been reached. No more 'field' events will be emitted.
+
+
+Busboy methods
+--------------
+
+* **(constructor)**(< _object_ >config) - Creates and returns a new Busboy instance.
+
+ * The constructor takes the following valid `config` settings:
+
+ * **headers** - _object_ - These are the HTTP headers of the incoming request, which are used by individual parsers.
+
+ * **autoDestroy** - _boolean_ - Whether this stream should automatically call .destroy() on itself after ending. (Default: false).
+
+ * **highWaterMark** - _integer_ - highWaterMark to use for this Busboy instance (Default: WritableStream default).
+
+ * **fileHwm** - _integer_ - highWaterMark to use for file streams (Default: ReadableStream default).
+
+ * **defCharset** - _string_ - Default character set to use when one isn't defined (Default: 'utf8').
+
+ * **preservePath** - _boolean_ - If paths in the multipart 'filename' field shall be preserved. (Default: false).
+
+ * **isPartAFile** - __function__ - Use this function to override the default file detection functionality. It has following parameters:
+
+ * fieldName - __string__ The name of the field.
+
+ * contentType - __string__ The content-type of the part, e.g. `text/plain`, `image/jpeg`, `application/octet-stream`
+
+ * fileName - __string__ The name of a file supplied by the part.
+
+ (Default: `(fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined)`)
+
+ * **limits** - _object_ - Various limits on incoming data. Valid properties are:
+
+ * **fieldNameSize** - _integer_ - Max field name size (in bytes) (Default: 100 bytes).
+
+ * **fieldSize** - _integer_ - Max field value size (in bytes) (Default: 1 MiB, which is 1024 x 1024 bytes).
+
+ * **fields** - _integer_ - Max number of non-file fields (Default: Infinity).
+
+ * **fileSize** - _integer_ - For multipart forms, the max file size (in bytes) (Default: Infinity).
+
+ * **files** - _integer_ - For multipart forms, the max number of file fields (Default: Infinity).
+
+ * **parts** - _integer_ - For multipart forms, the max number of parts (fields + files) (Default: Infinity).
+
+ * **headerPairs** - _integer_ - For multipart forms, the max number of header key=>value pairs to parse **Default:** 2000
+
+ * **headerSize** - _integer_ - For multipart forms, the max size of a multipart header **Default:** 81920.
+
+ * The constructor can throw errors:
+
+ * **Busboy expected an options-Object.** - Busboy expected an Object as first parameters.
+
+ * **Busboy expected an options-Object with headers-attribute.** - The first parameter is lacking of a headers-attribute.
+
+ * **Limit $limit is not a valid number** - Busboy expected the desired limit to be of type number. Busboy throws this Error to prevent a potential security issue by falling silently back to the Busboy-defaults. Potential source for this Error can be the direct use of environment variables without transforming them to the type number.
+
+ * **Unsupported Content-Type.** - The `Content-Type` isn't one Busboy can parse.
+
+ * **Missing Content-Type-header.** - The provided headers don't include `Content-Type` at all.
diff --git a/node_modules/streamsearch/LICENSE b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/LICENSE
similarity index 98%
rename from node_modules/streamsearch/LICENSE
rename to node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/LICENSE
index 9ea90e0..290762e 100644
--- a/node_modules/streamsearch/LICENSE
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/LICENSE
@@ -1,19 +1,19 @@
-Copyright Brian White. All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to
-deal in the Software without restriction, including without limitation the
-rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-sell copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+Copyright Brian White. All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
\ No newline at end of file
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js
new file mode 100644
index 0000000..3c8c081
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/Dicer.js
@@ -0,0 +1,213 @@
+'use strict'
+
+const WritableStream = require('node:stream').Writable
+const inherits = require('node:util').inherits
+
+const StreamSearch = require('../../streamsearch/sbmh')
+
+const PartStream = require('./PartStream')
+const HeaderParser = require('./HeaderParser')
+
+const DASH = 45
+const B_ONEDASH = Buffer.from('-')
+const B_CRLF = Buffer.from('\r\n')
+const EMPTY_FN = function () {}
+
+function Dicer (cfg) {
+ if (!(this instanceof Dicer)) { return new Dicer(cfg) }
+ WritableStream.call(this, cfg)
+
+ if (!cfg || (!cfg.headerFirst && typeof cfg.boundary !== 'string')) { throw new TypeError('Boundary required') }
+
+ if (typeof cfg.boundary === 'string') { this.setBoundary(cfg.boundary) } else { this._bparser = undefined }
+
+ this._headerFirst = cfg.headerFirst
+
+ this._dashes = 0
+ this._parts = 0
+ this._finished = false
+ this._realFinish = false
+ this._isPreamble = true
+ this._justMatched = false
+ this._firstWrite = true
+ this._inHeader = true
+ this._part = undefined
+ this._cb = undefined
+ this._ignoreData = false
+ this._partOpts = { highWaterMark: cfg.partHwm }
+ this._pause = false
+
+ const self = this
+ this._hparser = new HeaderParser(cfg)
+ this._hparser.on('header', function (header) {
+ self._inHeader = false
+ self._part.emit('header', header)
+ })
+}
+inherits(Dicer, WritableStream)
+
+Dicer.prototype.emit = function (ev) {
+ if (ev === 'finish' && !this._realFinish) {
+ if (!this._finished) {
+ const self = this
+ process.nextTick(function () {
+ self.emit('error', new Error('Unexpected end of multipart data'))
+ if (self._part && !self._ignoreData) {
+ const type = (self._isPreamble ? 'Preamble' : 'Part')
+ self._part.emit('error', new Error(type + ' terminated early due to unexpected end of multipart data'))
+ self._part.push(null)
+ process.nextTick(function () {
+ self._realFinish = true
+ self.emit('finish')
+ self._realFinish = false
+ })
+ return
+ }
+ self._realFinish = true
+ self.emit('finish')
+ self._realFinish = false
+ })
+ }
+ } else { WritableStream.prototype.emit.apply(this, arguments) }
+}
+
+Dicer.prototype._write = function (data, encoding, cb) {
+ // ignore unexpected data (e.g. extra trailer data after finished)
+ if (!this._hparser && !this._bparser) { return cb() }
+
+ if (this._headerFirst && this._isPreamble) {
+ if (!this._part) {
+ this._part = new PartStream(this._partOpts)
+ if (this.listenerCount('preamble') !== 0) { this.emit('preamble', this._part) } else { this._ignore() }
+ }
+ const r = this._hparser.push(data)
+ if (!this._inHeader && r !== undefined && r < data.length) { data = data.slice(r) } else { return cb() }
+ }
+
+ // allows for "easier" testing
+ if (this._firstWrite) {
+ this._bparser.push(B_CRLF)
+ this._firstWrite = false
+ }
+
+ this._bparser.push(data)
+
+ if (this._pause) { this._cb = cb } else { cb() }
+}
+
+Dicer.prototype.reset = function () {
+ this._part = undefined
+ this._bparser = undefined
+ this._hparser = undefined
+}
+
+Dicer.prototype.setBoundary = function (boundary) {
+ const self = this
+ this._bparser = new StreamSearch('\r\n--' + boundary)
+ this._bparser.on('info', function (isMatch, data, start, end) {
+ self._oninfo(isMatch, data, start, end)
+ })
+}
+
+Dicer.prototype._ignore = function () {
+ if (this._part && !this._ignoreData) {
+ this._ignoreData = true
+ this._part.on('error', EMPTY_FN)
+ // we must perform some kind of read on the stream even though we are
+ // ignoring the data, otherwise node's Readable stream will not emit 'end'
+ // after pushing null to the stream
+ this._part.resume()
+ }
+}
+
+Dicer.prototype._oninfo = function (isMatch, data, start, end) {
+ let buf; const self = this; let i = 0; let r; let shouldWriteMore = true
+
+ if (!this._part && this._justMatched && data) {
+ while (this._dashes < 2 && (start + i) < end) {
+ if (data[start + i] === DASH) {
+ ++i
+ ++this._dashes
+ } else {
+ if (this._dashes) { buf = B_ONEDASH }
+ this._dashes = 0
+ break
+ }
+ }
+ if (this._dashes === 2) {
+ if ((start + i) < end && this.listenerCount('trailer') !== 0) { this.emit('trailer', data.slice(start + i, end)) }
+ this.reset()
+ this._finished = true
+ // no more parts will be added
+ if (self._parts === 0) {
+ self._realFinish = true
+ self.emit('finish')
+ self._realFinish = false
+ }
+ }
+ if (this._dashes) { return }
+ }
+ if (this._justMatched) { this._justMatched = false }
+ if (!this._part) {
+ this._part = new PartStream(this._partOpts)
+ this._part._read = function (n) {
+ self._unpause()
+ }
+ if (this._isPreamble && this.listenerCount('preamble') !== 0) {
+ this.emit('preamble', this._part)
+ } else if (this._isPreamble !== true && this.listenerCount('part') !== 0) {
+ this.emit('part', this._part)
+ } else {
+ this._ignore()
+ }
+ if (!this._isPreamble) { this._inHeader = true }
+ }
+ if (data && start < end && !this._ignoreData) {
+ if (this._isPreamble || !this._inHeader) {
+ if (buf) { shouldWriteMore = this._part.push(buf) }
+ shouldWriteMore = this._part.push(data.slice(start, end))
+ if (!shouldWriteMore) { this._pause = true }
+ } else if (!this._isPreamble && this._inHeader) {
+ if (buf) { this._hparser.push(buf) }
+ r = this._hparser.push(data.slice(start, end))
+ if (!this._inHeader && r !== undefined && r < end) { this._oninfo(false, data, start + r, end) }
+ }
+ }
+ if (isMatch) {
+ this._hparser.reset()
+ if (this._isPreamble) { this._isPreamble = false } else {
+ if (start !== end) {
+ ++this._parts
+ this._part.on('end', function () {
+ if (--self._parts === 0) {
+ if (self._finished) {
+ self._realFinish = true
+ self.emit('finish')
+ self._realFinish = false
+ } else {
+ self._unpause()
+ }
+ }
+ })
+ }
+ }
+ this._part.push(null)
+ this._part = undefined
+ this._ignoreData = false
+ this._justMatched = true
+ this._dashes = 0
+ }
+}
+
+Dicer.prototype._unpause = function () {
+ if (!this._pause) { return }
+
+ this._pause = false
+ if (this._cb) {
+ const cb = this._cb
+ this._cb = undefined
+ cb()
+ }
+}
+
+module.exports = Dicer
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js
new file mode 100644
index 0000000..65f667b
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/HeaderParser.js
@@ -0,0 +1,100 @@
+'use strict'
+
+const EventEmitter = require('node:events').EventEmitter
+const inherits = require('node:util').inherits
+const getLimit = require('../../../lib/utils/getLimit')
+
+const StreamSearch = require('../../streamsearch/sbmh')
+
+const B_DCRLF = Buffer.from('\r\n\r\n')
+const RE_CRLF = /\r\n/g
+const RE_HDR = /^([^:]+):[ \t]?([\x00-\xFF]+)?$/ // eslint-disable-line no-control-regex
+
+function HeaderParser (cfg) {
+ EventEmitter.call(this)
+
+ cfg = cfg || {}
+ const self = this
+ this.nread = 0
+ this.maxed = false
+ this.npairs = 0
+ this.maxHeaderPairs = getLimit(cfg, 'maxHeaderPairs', 2000)
+ this.maxHeaderSize = getLimit(cfg, 'maxHeaderSize', 80 * 1024)
+ this.buffer = ''
+ this.header = {}
+ this.finished = false
+ this.ss = new StreamSearch(B_DCRLF)
+ this.ss.on('info', function (isMatch, data, start, end) {
+ if (data && !self.maxed) {
+ if (self.nread + end - start >= self.maxHeaderSize) {
+ end = self.maxHeaderSize - self.nread + start
+ self.nread = self.maxHeaderSize
+ self.maxed = true
+ } else { self.nread += (end - start) }
+
+ self.buffer += data.toString('binary', start, end)
+ }
+ if (isMatch) { self._finish() }
+ })
+}
+inherits(HeaderParser, EventEmitter)
+
+HeaderParser.prototype.push = function (data) {
+ const r = this.ss.push(data)
+ if (this.finished) { return r }
+}
+
+HeaderParser.prototype.reset = function () {
+ this.finished = false
+ this.buffer = ''
+ this.header = {}
+ this.ss.reset()
+}
+
+HeaderParser.prototype._finish = function () {
+ if (this.buffer) { this._parseHeader() }
+ this.ss.matches = this.ss.maxMatches
+ const header = this.header
+ this.header = {}
+ this.buffer = ''
+ this.finished = true
+ this.nread = this.npairs = 0
+ this.maxed = false
+ this.emit('header', header)
+}
+
+HeaderParser.prototype._parseHeader = function () {
+ if (this.npairs === this.maxHeaderPairs) { return }
+
+ const lines = this.buffer.split(RE_CRLF)
+ const len = lines.length
+ let m, h
+
+ for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
+ if (lines[i].length === 0) { continue }
+ if (lines[i][0] === '\t' || lines[i][0] === ' ') {
+ // folded header content
+ // RFC2822 says to just remove the CRLF and not the whitespace following
+ // it, so we follow the RFC and include the leading whitespace ...
+ if (h) {
+ this.header[h][this.header[h].length - 1] += lines[i]
+ continue
+ }
+ }
+
+ const posColon = lines[i].indexOf(':')
+ if (
+ posColon === -1 ||
+ posColon === 0
+ ) {
+ return
+ }
+ m = RE_HDR.exec(lines[i])
+ h = m[1].toLowerCase()
+ this.header[h] = this.header[h] || []
+ this.header[h].push((m[2] || ''))
+ if (++this.npairs === this.maxHeaderPairs) { break }
+ }
+}
+
+module.exports = HeaderParser
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js
new file mode 100644
index 0000000..c91da1c
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/PartStream.js
@@ -0,0 +1,13 @@
+'use strict'
+
+const inherits = require('node:util').inherits
+const ReadableStream = require('node:stream').Readable
+
+function PartStream (opts) {
+ ReadableStream.call(this, opts)
+}
+inherits(PartStream, ReadableStream)
+
+PartStream.prototype._read = function (n) {}
+
+module.exports = PartStream
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts
new file mode 100644
index 0000000..3c5b896
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/dicer/lib/dicer.d.ts
@@ -0,0 +1,164 @@
+// Type definitions for dicer 0.2
+// Project: https://github.com/mscdex/dicer
+// Definitions by: BendingBender
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.2
+///
+
+import stream = require("stream");
+
+// tslint:disable:unified-signatures
+
+/**
+ * A very fast streaming multipart parser for node.js.
+ * Dicer is a WritableStream
+ *
+ * Dicer (special) events:
+ * - on('finish', ()) - Emitted when all parts have been parsed and the Dicer instance has been ended.
+ * - on('part', (stream: PartStream)) - Emitted when a new part has been found.
+ * - on('preamble', (stream: PartStream)) - Emitted for preamble if you should happen to need it (can usually be ignored).
+ * - on('trailer', (data: Buffer)) - Emitted when trailing data was found after the terminating boundary (as with the preamble, this can usually be ignored too).
+ */
+export class Dicer extends stream.Writable {
+ /**
+ * Creates and returns a new Dicer instance with the following valid config settings:
+ *
+ * @param config The configuration to use
+ */
+ constructor(config: Dicer.Config);
+ /**
+ * Sets the boundary to use for parsing and performs some initialization needed for parsing.
+ * You should only need to use this if you set headerFirst to true in the constructor and are parsing the boundary from the preamble header.
+ *
+ * @param boundary The boundary to use
+ */
+ setBoundary(boundary: string): void;
+ addListener(event: "finish", listener: () => void): this;
+ addListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ addListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ addListener(event: "trailer", listener: (data: Buffer) => void): this;
+ addListener(event: "close", listener: () => void): this;
+ addListener(event: "drain", listener: () => void): this;
+ addListener(event: "error", listener: (err: Error) => void): this;
+ addListener(event: "pipe", listener: (src: stream.Readable) => void): this;
+ addListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ on(event: "finish", listener: () => void): this;
+ on(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ on(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ on(event: "trailer", listener: (data: Buffer) => void): this;
+ on(event: "close", listener: () => void): this;
+ on(event: "drain", listener: () => void): this;
+ on(event: "error", listener: (err: Error) => void): this;
+ on(event: "pipe", listener: (src: stream.Readable) => void): this;
+ on(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ on(event: string, listener: (...args: any[]) => void): this;
+ once(event: "finish", listener: () => void): this;
+ once(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ once(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ once(event: "trailer", listener: (data: Buffer) => void): this;
+ once(event: "close", listener: () => void): this;
+ once(event: "drain", listener: () => void): this;
+ once(event: "error", listener: (err: Error) => void): this;
+ once(event: "pipe", listener: (src: stream.Readable) => void): this;
+ once(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ once(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "finish", listener: () => void): this;
+ prependListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ prependListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ prependListener(event: "trailer", listener: (data: Buffer) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+ prependListener(event: "drain", listener: () => void): this;
+ prependListener(event: "error", listener: (err: Error) => void): this;
+ prependListener(event: "pipe", listener: (src: stream.Readable) => void): this;
+ prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "finish", listener: () => void): this;
+ prependOnceListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ prependOnceListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ prependOnceListener(event: "trailer", listener: (data: Buffer) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ prependOnceListener(event: "drain", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
+ prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this;
+ prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ removeListener(event: "finish", listener: () => void): this;
+ removeListener(event: "part", listener: (stream: Dicer.PartStream) => void): this;
+ removeListener(event: "preamble", listener: (stream: Dicer.PartStream) => void): this;
+ removeListener(event: "trailer", listener: (data: Buffer) => void): this;
+ removeListener(event: "close", listener: () => void): this;
+ removeListener(event: "drain", listener: () => void): this;
+ removeListener(event: "error", listener: (err: Error) => void): this;
+ removeListener(event: "pipe", listener: (src: stream.Readable) => void): this;
+ removeListener(event: "unpipe", listener: (src: stream.Readable) => void): this;
+ removeListener(event: string, listener: (...args: any[]) => void): this;
+}
+
+declare namespace Dicer {
+ interface Config {
+ /**
+ * This is the boundary used to detect the beginning of a new part.
+ */
+ boundary?: string | undefined;
+ /**
+ * If true, preamble header parsing will be performed first.
+ */
+ headerFirst?: boolean | undefined;
+ /**
+ * The maximum number of header key=>value pairs to parse Default: 2000 (same as node's http).
+ */
+ maxHeaderPairs?: number | undefined;
+ }
+
+ /**
+ * PartStream is a _ReadableStream_
+ *
+ * PartStream (special) events:
+ * - on('header', (header: object)) - An object containing the header for this particular part. Each property value is an array of one or more string values.
+ */
+ interface PartStream extends stream.Readable {
+ addListener(event: "header", listener: (header: object) => void): this;
+ addListener(event: "close", listener: () => void): this;
+ addListener(event: "data", listener: (chunk: Buffer | string) => void): this;
+ addListener(event: "end", listener: () => void): this;
+ addListener(event: "readable", listener: () => void): this;
+ addListener(event: "error", listener: (err: Error) => void): this;
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ on(event: "header", listener: (header: object) => void): this;
+ on(event: "close", listener: () => void): this;
+ on(event: "data", listener: (chunk: Buffer | string) => void): this;
+ on(event: "end", listener: () => void): this;
+ on(event: "readable", listener: () => void): this;
+ on(event: "error", listener: (err: Error) => void): this;
+ on(event: string, listener: (...args: any[]) => void): this;
+ once(event: "header", listener: (header: object) => void): this;
+ once(event: "close", listener: () => void): this;
+ once(event: "data", listener: (chunk: Buffer | string) => void): this;
+ once(event: "end", listener: () => void): this;
+ once(event: "readable", listener: () => void): this;
+ once(event: "error", listener: (err: Error) => void): this;
+ once(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "header", listener: (header: object) => void): this;
+ prependListener(event: "close", listener: () => void): this;
+ prependListener(event: "data", listener: (chunk: Buffer | string) => void): this;
+ prependListener(event: "end", listener: () => void): this;
+ prependListener(event: "readable", listener: () => void): this;
+ prependListener(event: "error", listener: (err: Error) => void): this;
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "header", listener: (header: object) => void): this;
+ prependOnceListener(event: "close", listener: () => void): this;
+ prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this;
+ prependOnceListener(event: "end", listener: () => void): this;
+ prependOnceListener(event: "readable", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ removeListener(event: "header", listener: (header: object) => void): this;
+ removeListener(event: "close", listener: () => void): this;
+ removeListener(event: "data", listener: (chunk: Buffer | string) => void): this;
+ removeListener(event: "end", listener: () => void): this;
+ removeListener(event: "readable", listener: () => void): this;
+ removeListener(event: "error", listener: (err: Error) => void): this;
+ removeListener(event: string, listener: (...args: any[]) => void): this;
+ }
+}
\ No newline at end of file
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
new file mode 100644
index 0000000..b90c0e8
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/deps/streamsearch/sbmh.js
@@ -0,0 +1,228 @@
+'use strict'
+
+/**
+ * Copyright Brian White. All rights reserved.
+ *
+ * @see https://github.com/mscdex/streamsearch
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Based heavily on the Streaming Boyer-Moore-Horspool C++ implementation
+ * by Hongli Lai at: https://github.com/FooBarWidget/boyer-moore-horspool
+ */
+const EventEmitter = require('node:events').EventEmitter
+const inherits = require('node:util').inherits
+
+function SBMH (needle) {
+ if (typeof needle === 'string') {
+ needle = Buffer.from(needle)
+ }
+
+ if (!Buffer.isBuffer(needle)) {
+ throw new TypeError('The needle has to be a String or a Buffer.')
+ }
+
+ const needleLength = needle.length
+
+ if (needleLength === 0) {
+ throw new Error('The needle cannot be an empty String/Buffer.')
+ }
+
+ if (needleLength > 256) {
+ throw new Error('The needle cannot have a length bigger than 256.')
+ }
+
+ this.maxMatches = Infinity
+ this.matches = 0
+
+ this._occ = new Array(256)
+ .fill(needleLength) // Initialize occurrence table.
+ this._lookbehind_size = 0
+ this._needle = needle
+ this._bufpos = 0
+
+ this._lookbehind = Buffer.alloc(needleLength)
+
+ // Populate occurrence table with analysis of the needle,
+ // ignoring last letter.
+ for (var i = 0; i < needleLength - 1; ++i) { // eslint-disable-line no-var
+ this._occ[needle[i]] = needleLength - 1 - i
+ }
+}
+inherits(SBMH, EventEmitter)
+
+SBMH.prototype.reset = function () {
+ this._lookbehind_size = 0
+ this.matches = 0
+ this._bufpos = 0
+}
+
+SBMH.prototype.push = function (chunk, pos) {
+ if (!Buffer.isBuffer(chunk)) {
+ chunk = Buffer.from(chunk, 'binary')
+ }
+ const chlen = chunk.length
+ this._bufpos = pos || 0
+ let r
+ while (r !== chlen && this.matches < this.maxMatches) { r = this._sbmh_feed(chunk) }
+ return r
+}
+
+SBMH.prototype._sbmh_feed = function (data) {
+ const len = data.length
+ const needle = this._needle
+ const needleLength = needle.length
+ const lastNeedleChar = needle[needleLength - 1]
+
+ // Positive: points to a position in `data`
+ // pos == 3 points to data[3]
+ // Negative: points to a position in the lookbehind buffer
+ // pos == -2 points to lookbehind[lookbehind_size - 2]
+ let pos = -this._lookbehind_size
+ let ch
+
+ if (pos < 0) {
+ // Lookbehind buffer is not empty. Perform Boyer-Moore-Horspool
+ // search with character lookup code that considers both the
+ // lookbehind buffer and the current round's haystack data.
+ //
+ // Loop until
+ // there is a match.
+ // or until
+ // we've moved past the position that requires the
+ // lookbehind buffer. In this case we switch to the
+ // optimized loop.
+ // or until
+ // the character to look at lies outside the haystack.
+ while (pos < 0 && pos <= len - needleLength) {
+ ch = this._sbmh_lookup_char(data, pos + needleLength - 1)
+
+ if (
+ ch === lastNeedleChar &&
+ this._sbmh_memcmp(data, pos, needleLength - 1)
+ ) {
+ this._lookbehind_size = 0
+ ++this.matches
+ this.emit('info', true)
+
+ return (this._bufpos = pos + needleLength)
+ }
+ pos += this._occ[ch]
+ }
+
+ // No match.
+
+ if (pos < 0) {
+ // There's too few data for Boyer-Moore-Horspool to run,
+ // so let's use a different algorithm to skip as much as
+ // we can.
+ // Forward pos until
+ // the trailing part of lookbehind + data
+ // looks like the beginning of the needle
+ // or until
+ // pos == 0
+ while (pos < 0 && !this._sbmh_memcmp(data, pos, len - pos)) { ++pos }
+ }
+
+ if (pos >= 0) {
+ // Discard lookbehind buffer.
+ this.emit('info', false, this._lookbehind, 0, this._lookbehind_size)
+ this._lookbehind_size = 0
+ } else {
+ // Cut off part of the lookbehind buffer that has
+ // been processed and append the entire haystack
+ // into it.
+ const bytesToCutOff = this._lookbehind_size + pos
+ if (bytesToCutOff > 0) {
+ // The cut off data is guaranteed not to contain the needle.
+ this.emit('info', false, this._lookbehind, 0, bytesToCutOff)
+ }
+
+ this._lookbehind.copy(this._lookbehind, 0, bytesToCutOff,
+ this._lookbehind_size - bytesToCutOff)
+ this._lookbehind_size -= bytesToCutOff
+
+ data.copy(this._lookbehind, this._lookbehind_size)
+ this._lookbehind_size += len
+
+ this._bufpos = len
+ return len
+ }
+ }
+
+ pos += (pos >= 0) * this._bufpos
+
+ // Lookbehind buffer is now empty. We only need to check if the
+ // needle is in the haystack.
+ if (data.indexOf(needle, pos) !== -1) {
+ pos = data.indexOf(needle, pos)
+ ++this.matches
+ if (pos > 0) { this.emit('info', true, data, this._bufpos, pos) } else { this.emit('info', true) }
+
+ return (this._bufpos = pos + needleLength)
+ } else {
+ pos = len - needleLength
+ }
+
+ // There was no match. If there's trailing haystack data that we cannot
+ // match yet using the Boyer-Moore-Horspool algorithm (because the trailing
+ // data is less than the needle size) then match using a modified
+ // algorithm that starts matching from the beginning instead of the end.
+ // Whatever trailing data is left after running this algorithm is added to
+ // the lookbehind buffer.
+ while (
+ pos < len &&
+ (
+ data[pos] !== needle[0] ||
+ (
+ (Buffer.compare(
+ data.subarray(pos, pos + len - pos),
+ needle.subarray(0, len - pos)
+ ) !== 0)
+ )
+ )
+ ) {
+ ++pos
+ }
+ if (pos < len) {
+ data.copy(this._lookbehind, 0, pos, pos + (len - pos))
+ this._lookbehind_size = len - pos
+ }
+
+ // Everything until pos is guaranteed not to contain needle data.
+ if (pos > 0) { this.emit('info', false, data, this._bufpos, pos < len ? pos : len) }
+
+ this._bufpos = len
+ return len
+}
+
+SBMH.prototype._sbmh_lookup_char = function (data, pos) {
+ return (pos < 0)
+ ? this._lookbehind[this._lookbehind_size + pos]
+ : data[pos]
+}
+
+SBMH.prototype._sbmh_memcmp = function (data, pos, len) {
+ for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
+ if (this._sbmh_lookup_char(data, pos + i) !== this._needle[i]) { return false }
+ }
+ return true
+}
+
+module.exports = SBMH
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.d.ts b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.d.ts
new file mode 100644
index 0000000..91b6448
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.d.ts
@@ -0,0 +1,196 @@
+// Definitions by: Jacob Baskin
+// BendingBender
+// Igor Savin
+
+///
+
+import * as http from 'http';
+import { Readable, Writable } from 'stream';
+export { Dicer } from "../deps/dicer/lib/dicer";
+
+export const Busboy: BusboyConstructor;
+export default Busboy;
+
+export interface BusboyConfig {
+ /**
+ * These are the HTTP headers of the incoming request, which are used by individual parsers.
+ */
+ headers: BusboyHeaders;
+ /**
+ * `highWaterMark` to use for this Busboy instance.
+ * @default WritableStream default.
+ */
+ highWaterMark?: number | undefined;
+ /**
+ * highWaterMark to use for file streams.
+ * @default ReadableStream default.
+ */
+ fileHwm?: number | undefined;
+ /**
+ * Default character set to use when one isn't defined.
+ * @default 'utf8'
+ */
+ defCharset?: string | undefined;
+ /**
+ * Detect if a Part is a file.
+ *
+ * By default a file is detected if contentType
+ * is application/octet-stream or fileName is not
+ * undefined.
+ *
+ * Modify this to handle e.g. Blobs.
+ */
+ isPartAFile?: (fieldName: string | undefined, contentType: string | undefined, fileName: string | undefined) => boolean;
+ /**
+ * If paths in the multipart 'filename' field shall be preserved.
+ * @default false
+ */
+ preservePath?: boolean | undefined;
+ /**
+ * Various limits on incoming data.
+ */
+ limits?:
+ | {
+ /**
+ * Max field name size (in bytes)
+ * @default 100 bytes
+ */
+ fieldNameSize?: number | undefined;
+ /**
+ * Max field value size (in bytes)
+ * @default 1MB
+ */
+ fieldSize?: number | undefined;
+ /**
+ * Max number of non-file fields
+ * @default Infinity
+ */
+ fields?: number | undefined;
+ /**
+ * For multipart forms, the max file size (in bytes)
+ * @default Infinity
+ */
+ fileSize?: number | undefined;
+ /**
+ * For multipart forms, the max number of file fields
+ * @default Infinity
+ */
+ files?: number | undefined;
+ /**
+ * For multipart forms, the max number of parts (fields + files)
+ * @default Infinity
+ */
+ parts?: number | undefined;
+ /**
+ * For multipart forms, the max number of header key=>value pairs to parse
+ * @default 2000
+ */
+ headerPairs?: number | undefined;
+
+ /**
+ * For multipart forms, the max size of a header part
+ * @default 81920
+ */
+ headerSize?: number | undefined;
+ }
+ | undefined;
+}
+
+export type BusboyHeaders = { 'content-type': string } & http.IncomingHttpHeaders;
+
+export interface BusboyFileStream extends
+ Readable {
+
+ truncated: boolean;
+
+ /**
+ * The number of bytes that have been read so far.
+ */
+ bytesRead: number;
+}
+
+export interface Busboy extends Writable {
+ addListener(event: Event, listener: BusboyEvents[Event]): this;
+
+ addListener(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ on(event: Event, listener: BusboyEvents[Event]): this;
+
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ once(event: Event, listener: BusboyEvents[Event]): this;
+
+ once(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ removeListener(event: Event, listener: BusboyEvents[Event]): this;
+
+ removeListener(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ off(event: Event, listener: BusboyEvents[Event]): this;
+
+ off(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ prependListener(event: Event, listener: BusboyEvents[Event]): this;
+
+ prependListener(event: string | symbol, listener: (...args: any[]) => void): this;
+
+ prependOnceListener(event: Event, listener: BusboyEvents[Event]): this;
+
+ prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this;
+}
+
+export interface BusboyEvents {
+ /**
+ * Emitted for each new file form field found.
+ *
+ * * Note: if you listen for this event, you should always handle the `stream` no matter if you care about the
+ * file contents or not (e.g. you can simply just do `stream.resume();` if you want to discard the contents),
+ * otherwise the 'finish' event will never fire on the Busboy instance. However, if you don't care about **any**
+ * incoming files, you can simply not listen for the 'file' event at all and any/all files will be automatically
+ * and safely discarded (these discarded files do still count towards `files` and `parts` limits).
+ * * If a configured file size limit was reached, `stream` will both have a boolean property `truncated`
+ * (best checked at the end of the stream) and emit a 'limit' event to notify you when this happens.
+ *
+ * @param listener.transferEncoding Contains the 'Content-Transfer-Encoding' value for the file stream.
+ * @param listener.mimeType Contains the 'Content-Type' value for the file stream.
+ */
+ file: (
+ fieldname: string,
+ stream: BusboyFileStream,
+ filename: string,
+ transferEncoding: string,
+ mimeType: string,
+ ) => void;
+ /**
+ * Emitted for each new non-file field found.
+ */
+ field: (
+ fieldname: string,
+ value: string,
+ fieldnameTruncated: boolean,
+ valueTruncated: boolean,
+ transferEncoding: string,
+ mimeType: string,
+ ) => void;
+ finish: () => void;
+ /**
+ * Emitted when specified `parts` limit has been reached. No more 'file' or 'field' events will be emitted.
+ */
+ partsLimit: () => void;
+ /**
+ * Emitted when specified `files` limit has been reached. No more 'file' events will be emitted.
+ */
+ filesLimit: () => void;
+ /**
+ * Emitted when specified `fields` limit has been reached. No more 'field' events will be emitted.
+ */
+ fieldsLimit: () => void;
+ error: (error: unknown) => void;
+}
+
+export interface BusboyConstructor {
+ (options: BusboyConfig): Busboy;
+
+ new(options: BusboyConfig): Busboy;
+}
+
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js
new file mode 100644
index 0000000..8794beb
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/main.js
@@ -0,0 +1,85 @@
+'use strict'
+
+const WritableStream = require('node:stream').Writable
+const { inherits } = require('node:util')
+const Dicer = require('../deps/dicer/lib/Dicer')
+
+const MultipartParser = require('./types/multipart')
+const UrlencodedParser = require('./types/urlencoded')
+const parseParams = require('./utils/parseParams')
+
+function Busboy (opts) {
+ if (!(this instanceof Busboy)) { return new Busboy(opts) }
+
+ if (typeof opts !== 'object') {
+ throw new TypeError('Busboy expected an options-Object.')
+ }
+ if (typeof opts.headers !== 'object') {
+ throw new TypeError('Busboy expected an options-Object with headers-attribute.')
+ }
+ if (typeof opts.headers['content-type'] !== 'string') {
+ throw new TypeError('Missing Content-Type-header.')
+ }
+
+ const {
+ headers,
+ ...streamOptions
+ } = opts
+
+ this.opts = {
+ autoDestroy: false,
+ ...streamOptions
+ }
+ WritableStream.call(this, this.opts)
+
+ this._done = false
+ this._parser = this.getParserByHeaders(headers)
+ this._finished = false
+}
+inherits(Busboy, WritableStream)
+
+Busboy.prototype.emit = function (ev) {
+ if (ev === 'finish') {
+ if (!this._done) {
+ this._parser?.end()
+ return
+ } else if (this._finished) {
+ return
+ }
+ this._finished = true
+ }
+ WritableStream.prototype.emit.apply(this, arguments)
+}
+
+Busboy.prototype.getParserByHeaders = function (headers) {
+ const parsed = parseParams(headers['content-type'])
+
+ const cfg = {
+ defCharset: this.opts.defCharset,
+ fileHwm: this.opts.fileHwm,
+ headers,
+ highWaterMark: this.opts.highWaterMark,
+ isPartAFile: this.opts.isPartAFile,
+ limits: this.opts.limits,
+ parsedConType: parsed,
+ preservePath: this.opts.preservePath
+ }
+
+ if (MultipartParser.detect.test(parsed[0])) {
+ return new MultipartParser(this, cfg)
+ }
+ if (UrlencodedParser.detect.test(parsed[0])) {
+ return new UrlencodedParser(this, cfg)
+ }
+ throw new Error('Unsupported Content-Type.')
+}
+
+Busboy.prototype._write = function (chunk, encoding, cb) {
+ this._parser.write(chunk, cb)
+}
+
+module.exports = Busboy
+module.exports.default = Busboy
+module.exports.Busboy = Busboy
+
+module.exports.Dicer = Dicer
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/multipart.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/multipart.js
new file mode 100644
index 0000000..d691eca
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/multipart.js
@@ -0,0 +1,306 @@
+'use strict'
+
+// TODO:
+// * support 1 nested multipart level
+// (see second multipart example here:
+// http://www.w3.org/TR/html401/interact/forms.html#didx-multipartform-data)
+// * support limits.fieldNameSize
+// -- this will require modifications to utils.parseParams
+
+const { Readable } = require('node:stream')
+const { inherits } = require('node:util')
+
+const Dicer = require('../../deps/dicer/lib/Dicer')
+
+const parseParams = require('../utils/parseParams')
+const decodeText = require('../utils/decodeText')
+const basename = require('../utils/basename')
+const getLimit = require('../utils/getLimit')
+
+const RE_BOUNDARY = /^boundary$/i
+const RE_FIELD = /^form-data$/i
+const RE_CHARSET = /^charset$/i
+const RE_FILENAME = /^filename$/i
+const RE_NAME = /^name$/i
+
+Multipart.detect = /^multipart\/form-data/i
+function Multipart (boy, cfg) {
+ let i
+ let len
+ const self = this
+ let boundary
+ const limits = cfg.limits
+ const isPartAFile = cfg.isPartAFile || ((fieldName, contentType, fileName) => (contentType === 'application/octet-stream' || fileName !== undefined))
+ const parsedConType = cfg.parsedConType || []
+ const defCharset = cfg.defCharset || 'utf8'
+ const preservePath = cfg.preservePath
+ const fileOpts = { highWaterMark: cfg.fileHwm }
+
+ for (i = 0, len = parsedConType.length; i < len; ++i) {
+ if (Array.isArray(parsedConType[i]) &&
+ RE_BOUNDARY.test(parsedConType[i][0])) {
+ boundary = parsedConType[i][1]
+ break
+ }
+ }
+
+ function checkFinished () {
+ if (nends === 0 && finished && !boy._done) {
+ finished = false
+ self.end()
+ }
+ }
+
+ if (typeof boundary !== 'string') { throw new Error('Multipart: Boundary not found') }
+
+ const fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
+ const fileSizeLimit = getLimit(limits, 'fileSize', Infinity)
+ const filesLimit = getLimit(limits, 'files', Infinity)
+ const fieldsLimit = getLimit(limits, 'fields', Infinity)
+ const partsLimit = getLimit(limits, 'parts', Infinity)
+ const headerPairsLimit = getLimit(limits, 'headerPairs', 2000)
+ const headerSizeLimit = getLimit(limits, 'headerSize', 80 * 1024)
+
+ let nfiles = 0
+ let nfields = 0
+ let nends = 0
+ let curFile
+ let curField
+ let finished = false
+
+ this._needDrain = false
+ this._pause = false
+ this._cb = undefined
+ this._nparts = 0
+ this._boy = boy
+
+ const parserCfg = {
+ boundary,
+ maxHeaderPairs: headerPairsLimit,
+ maxHeaderSize: headerSizeLimit,
+ partHwm: fileOpts.highWaterMark,
+ highWaterMark: cfg.highWaterMark
+ }
+
+ this.parser = new Dicer(parserCfg)
+ this.parser.on('drain', function () {
+ self._needDrain = false
+ if (self._cb && !self._pause) {
+ const cb = self._cb
+ self._cb = undefined
+ cb()
+ }
+ }).on('part', function onPart (part) {
+ if (++self._nparts > partsLimit) {
+ self.parser.removeListener('part', onPart)
+ self.parser.on('part', skipPart)
+ boy.hitPartsLimit = true
+ boy.emit('partsLimit')
+ return skipPart(part)
+ }
+
+ // hack because streams2 _always_ doesn't emit 'end' until nextTick, so let
+ // us emit 'end' early since we know the part has ended if we are already
+ // seeing the next part
+ if (curField) {
+ const field = curField
+ field.emit('end')
+ field.removeAllListeners('end')
+ }
+
+ part.on('header', function (header) {
+ let contype
+ let fieldname
+ let parsed
+ let charset
+ let encoding
+ let filename
+ let nsize = 0
+
+ if (header['content-type']) {
+ parsed = parseParams(header['content-type'][0])
+ if (parsed[0]) {
+ contype = parsed[0].toLowerCase()
+ for (i = 0, len = parsed.length; i < len; ++i) {
+ if (RE_CHARSET.test(parsed[i][0])) {
+ charset = parsed[i][1].toLowerCase()
+ break
+ }
+ }
+ }
+ }
+
+ if (contype === undefined) { contype = 'text/plain' }
+ if (charset === undefined) { charset = defCharset }
+
+ if (header['content-disposition']) {
+ parsed = parseParams(header['content-disposition'][0])
+ if (!RE_FIELD.test(parsed[0])) { return skipPart(part) }
+ for (i = 0, len = parsed.length; i < len; ++i) {
+ if (RE_NAME.test(parsed[i][0])) {
+ fieldname = parsed[i][1]
+ } else if (RE_FILENAME.test(parsed[i][0])) {
+ filename = parsed[i][1]
+ if (!preservePath) { filename = basename(filename) }
+ }
+ }
+ } else { return skipPart(part) }
+
+ if (header['content-transfer-encoding']) { encoding = header['content-transfer-encoding'][0].toLowerCase() } else { encoding = '7bit' }
+
+ let onData,
+ onEnd
+
+ if (isPartAFile(fieldname, contype, filename)) {
+ // file/binary field
+ if (nfiles === filesLimit) {
+ if (!boy.hitFilesLimit) {
+ boy.hitFilesLimit = true
+ boy.emit('filesLimit')
+ }
+ return skipPart(part)
+ }
+
+ ++nfiles
+
+ if (boy.listenerCount('file') === 0) {
+ self.parser._ignore()
+ return
+ }
+
+ ++nends
+ const file = new FileStream(fileOpts)
+ curFile = file
+ file.on('end', function () {
+ --nends
+ self._pause = false
+ checkFinished()
+ if (self._cb && !self._needDrain) {
+ const cb = self._cb
+ self._cb = undefined
+ cb()
+ }
+ })
+ file._read = function (n) {
+ if (!self._pause) { return }
+ self._pause = false
+ if (self._cb && !self._needDrain) {
+ const cb = self._cb
+ self._cb = undefined
+ cb()
+ }
+ }
+ boy.emit('file', fieldname, file, filename, encoding, contype)
+
+ onData = function (data) {
+ if ((nsize += data.length) > fileSizeLimit) {
+ const extralen = fileSizeLimit - nsize + data.length
+ if (extralen > 0) { file.push(data.slice(0, extralen)) }
+ file.truncated = true
+ file.bytesRead = fileSizeLimit
+ part.removeAllListeners('data')
+ file.emit('limit')
+ return
+ } else if (!file.push(data)) { self._pause = true }
+
+ file.bytesRead = nsize
+ }
+
+ onEnd = function () {
+ curFile = undefined
+ file.push(null)
+ }
+ } else {
+ // non-file field
+ if (nfields === fieldsLimit) {
+ if (!boy.hitFieldsLimit) {
+ boy.hitFieldsLimit = true
+ boy.emit('fieldsLimit')
+ }
+ return skipPart(part)
+ }
+
+ ++nfields
+ ++nends
+ let buffer = ''
+ let truncated = false
+ curField = part
+
+ onData = function (data) {
+ if ((nsize += data.length) > fieldSizeLimit) {
+ const extralen = (fieldSizeLimit - (nsize - data.length))
+ buffer += data.toString('binary', 0, extralen)
+ truncated = true
+ part.removeAllListeners('data')
+ } else { buffer += data.toString('binary') }
+ }
+
+ onEnd = function () {
+ curField = undefined
+ if (buffer.length) { buffer = decodeText(buffer, 'binary', charset) }
+ boy.emit('field', fieldname, buffer, false, truncated, encoding, contype)
+ --nends
+ checkFinished()
+ }
+ }
+
+ /* As of node@2efe4ab761666 (v0.10.29+/v0.11.14+), busboy had become
+ broken. Streams2/streams3 is a huge black box of confusion, but
+ somehow overriding the sync state seems to fix things again (and still
+ seems to work for previous node versions).
+ */
+ part._readableState.sync = false
+
+ part.on('data', onData)
+ part.on('end', onEnd)
+ }).on('error', function (err) {
+ if (curFile) { curFile.emit('error', err) }
+ })
+ }).on('error', function (err) {
+ boy.emit('error', err)
+ }).on('finish', function () {
+ finished = true
+ checkFinished()
+ })
+}
+
+Multipart.prototype.write = function (chunk, cb) {
+ const r = this.parser.write(chunk)
+ if (r && !this._pause) {
+ cb()
+ } else {
+ this._needDrain = !r
+ this._cb = cb
+ }
+}
+
+Multipart.prototype.end = function () {
+ const self = this
+
+ if (self.parser.writable) {
+ self.parser.end()
+ } else if (!self._boy._done) {
+ process.nextTick(function () {
+ self._boy._done = true
+ self._boy.emit('finish')
+ })
+ }
+}
+
+function skipPart (part) {
+ part.resume()
+}
+
+function FileStream (opts) {
+ Readable.call(this, opts)
+
+ this.bytesRead = 0
+
+ this.truncated = false
+}
+
+inherits(FileStream, Readable)
+
+FileStream.prototype._read = function (n) {}
+
+module.exports = Multipart
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/urlencoded.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/urlencoded.js
new file mode 100644
index 0000000..6f5f784
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/types/urlencoded.js
@@ -0,0 +1,190 @@
+'use strict'
+
+const Decoder = require('../utils/Decoder')
+const decodeText = require('../utils/decodeText')
+const getLimit = require('../utils/getLimit')
+
+const RE_CHARSET = /^charset$/i
+
+UrlEncoded.detect = /^application\/x-www-form-urlencoded/i
+function UrlEncoded (boy, cfg) {
+ const limits = cfg.limits
+ const parsedConType = cfg.parsedConType
+ this.boy = boy
+
+ this.fieldSizeLimit = getLimit(limits, 'fieldSize', 1 * 1024 * 1024)
+ this.fieldNameSizeLimit = getLimit(limits, 'fieldNameSize', 100)
+ this.fieldsLimit = getLimit(limits, 'fields', Infinity)
+
+ let charset
+ for (var i = 0, len = parsedConType.length; i < len; ++i) { // eslint-disable-line no-var
+ if (Array.isArray(parsedConType[i]) &&
+ RE_CHARSET.test(parsedConType[i][0])) {
+ charset = parsedConType[i][1].toLowerCase()
+ break
+ }
+ }
+
+ if (charset === undefined) { charset = cfg.defCharset || 'utf8' }
+
+ this.decoder = new Decoder()
+ this.charset = charset
+ this._fields = 0
+ this._state = 'key'
+ this._checkingBytes = true
+ this._bytesKey = 0
+ this._bytesVal = 0
+ this._key = ''
+ this._val = ''
+ this._keyTrunc = false
+ this._valTrunc = false
+ this._hitLimit = false
+}
+
+UrlEncoded.prototype.write = function (data, cb) {
+ if (this._fields === this.fieldsLimit) {
+ if (!this.boy.hitFieldsLimit) {
+ this.boy.hitFieldsLimit = true
+ this.boy.emit('fieldsLimit')
+ }
+ return cb()
+ }
+
+ let idxeq; let idxamp; let i; let p = 0; const len = data.length
+
+ while (p < len) {
+ if (this._state === 'key') {
+ idxeq = idxamp = undefined
+ for (i = p; i < len; ++i) {
+ if (!this._checkingBytes) { ++p }
+ if (data[i] === 0x3D/* = */) {
+ idxeq = i
+ break
+ } else if (data[i] === 0x26/* & */) {
+ idxamp = i
+ break
+ }
+ if (this._checkingBytes && this._bytesKey === this.fieldNameSizeLimit) {
+ this._hitLimit = true
+ break
+ } else if (this._checkingBytes) { ++this._bytesKey }
+ }
+
+ if (idxeq !== undefined) {
+ // key with assignment
+ if (idxeq > p) { this._key += this.decoder.write(data.toString('binary', p, idxeq)) }
+ this._state = 'val'
+
+ this._hitLimit = false
+ this._checkingBytes = true
+ this._val = ''
+ this._bytesVal = 0
+ this._valTrunc = false
+ this.decoder.reset()
+
+ p = idxeq + 1
+ } else if (idxamp !== undefined) {
+ // key with no assignment
+ ++this._fields
+ let key; const keyTrunc = this._keyTrunc
+ if (idxamp > p) { key = (this._key += this.decoder.write(data.toString('binary', p, idxamp))) } else { key = this._key }
+
+ this._hitLimit = false
+ this._checkingBytes = true
+ this._key = ''
+ this._bytesKey = 0
+ this._keyTrunc = false
+ this.decoder.reset()
+
+ if (key.length) {
+ this.boy.emit('field', decodeText(key, 'binary', this.charset),
+ '',
+ keyTrunc,
+ false)
+ }
+
+ p = idxamp + 1
+ if (this._fields === this.fieldsLimit) { return cb() }
+ } else if (this._hitLimit) {
+ // we may not have hit the actual limit if there are encoded bytes...
+ if (i > p) { this._key += this.decoder.write(data.toString('binary', p, i)) }
+ p = i
+ if ((this._bytesKey = this._key.length) === this.fieldNameSizeLimit) {
+ // yep, we actually did hit the limit
+ this._checkingBytes = false
+ this._keyTrunc = true
+ }
+ } else {
+ if (p < len) { this._key += this.decoder.write(data.toString('binary', p)) }
+ p = len
+ }
+ } else {
+ idxamp = undefined
+ for (i = p; i < len; ++i) {
+ if (!this._checkingBytes) { ++p }
+ if (data[i] === 0x26/* & */) {
+ idxamp = i
+ break
+ }
+ if (this._checkingBytes && this._bytesVal === this.fieldSizeLimit) {
+ this._hitLimit = true
+ break
+ } else if (this._checkingBytes) { ++this._bytesVal }
+ }
+
+ if (idxamp !== undefined) {
+ ++this._fields
+ if (idxamp > p) { this._val += this.decoder.write(data.toString('binary', p, idxamp)) }
+ this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
+ decodeText(this._val, 'binary', this.charset),
+ this._keyTrunc,
+ this._valTrunc)
+ this._state = 'key'
+
+ this._hitLimit = false
+ this._checkingBytes = true
+ this._key = ''
+ this._bytesKey = 0
+ this._keyTrunc = false
+ this.decoder.reset()
+
+ p = idxamp + 1
+ if (this._fields === this.fieldsLimit) { return cb() }
+ } else if (this._hitLimit) {
+ // we may not have hit the actual limit if there are encoded bytes...
+ if (i > p) { this._val += this.decoder.write(data.toString('binary', p, i)) }
+ p = i
+ if ((this._val === '' && this.fieldSizeLimit === 0) ||
+ (this._bytesVal = this._val.length) === this.fieldSizeLimit) {
+ // yep, we actually did hit the limit
+ this._checkingBytes = false
+ this._valTrunc = true
+ }
+ } else {
+ if (p < len) { this._val += this.decoder.write(data.toString('binary', p)) }
+ p = len
+ }
+ }
+ }
+ cb()
+}
+
+UrlEncoded.prototype.end = function () {
+ if (this.boy._done) { return }
+
+ if (this._state === 'key' && this._key.length > 0) {
+ this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
+ '',
+ this._keyTrunc,
+ false)
+ } else if (this._state === 'val') {
+ this.boy.emit('field', decodeText(this._key, 'binary', this.charset),
+ decodeText(this._val, 'binary', this.charset),
+ this._keyTrunc,
+ this._valTrunc)
+ }
+ this.boy._done = true
+ this.boy.emit('finish')
+}
+
+module.exports = UrlEncoded
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/Decoder.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/Decoder.js
new file mode 100644
index 0000000..7917678
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/Decoder.js
@@ -0,0 +1,54 @@
+'use strict'
+
+const RE_PLUS = /\+/g
+
+const HEX = [
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+]
+
+function Decoder () {
+ this.buffer = undefined
+}
+Decoder.prototype.write = function (str) {
+ // Replace '+' with ' ' before decoding
+ str = str.replace(RE_PLUS, ' ')
+ let res = ''
+ let i = 0; let p = 0; const len = str.length
+ for (; i < len; ++i) {
+ if (this.buffer !== undefined) {
+ if (!HEX[str.charCodeAt(i)]) {
+ res += '%' + this.buffer
+ this.buffer = undefined
+ --i // retry character
+ } else {
+ this.buffer += str[i]
+ ++p
+ if (this.buffer.length === 2) {
+ res += String.fromCharCode(parseInt(this.buffer, 16))
+ this.buffer = undefined
+ }
+ }
+ } else if (str[i] === '%') {
+ if (i > p) {
+ res += str.substring(p, i)
+ p = i
+ }
+ this.buffer = ''
+ ++p
+ }
+ }
+ if (p < len && this.buffer === undefined) { res += str.substring(p) }
+ return res
+}
+Decoder.prototype.reset = function () {
+ this.buffer = undefined
+}
+
+module.exports = Decoder
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js
new file mode 100644
index 0000000..db58819
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js
@@ -0,0 +1,14 @@
+'use strict'
+
+module.exports = function basename (path) {
+ if (typeof path !== 'string') { return '' }
+ for (var i = path.length - 1; i >= 0; --i) { // eslint-disable-line no-var
+ switch (path.charCodeAt(i)) {
+ case 0x2F: // '/'
+ case 0x5C: // '\'
+ path = path.slice(i + 1)
+ return (path === '..' || path === '.' ? '' : path)
+ }
+ }
+ return (path === '..' || path === '.' ? '' : path)
+}
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/decodeText.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/decodeText.js
new file mode 100644
index 0000000..eac7d35
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/decodeText.js
@@ -0,0 +1,114 @@
+'use strict'
+
+// Node has always utf-8
+const utf8Decoder = new TextDecoder('utf-8')
+const textDecoders = new Map([
+ ['utf-8', utf8Decoder],
+ ['utf8', utf8Decoder]
+])
+
+function getDecoder (charset) {
+ let lc
+ while (true) {
+ switch (charset) {
+ case 'utf-8':
+ case 'utf8':
+ return decoders.utf8
+ case 'latin1':
+ case 'ascii': // TODO: Make these a separate, strict decoder?
+ case 'us-ascii':
+ case 'iso-8859-1':
+ case 'iso8859-1':
+ case 'iso88591':
+ case 'iso_8859-1':
+ case 'windows-1252':
+ case 'iso_8859-1:1987':
+ case 'cp1252':
+ case 'x-cp1252':
+ return decoders.latin1
+ case 'utf16le':
+ case 'utf-16le':
+ case 'ucs2':
+ case 'ucs-2':
+ return decoders.utf16le
+ case 'base64':
+ return decoders.base64
+ default:
+ if (lc === undefined) {
+ lc = true
+ charset = charset.toLowerCase()
+ continue
+ }
+ return decoders.other.bind(charset)
+ }
+ }
+}
+
+const decoders = {
+ utf8: (data, sourceEncoding) => {
+ if (data.length === 0) {
+ return ''
+ }
+ if (typeof data === 'string') {
+ data = Buffer.from(data, sourceEncoding)
+ }
+ return data.utf8Slice(0, data.length)
+ },
+
+ latin1: (data, sourceEncoding) => {
+ if (data.length === 0) {
+ return ''
+ }
+ if (typeof data === 'string') {
+ return data
+ }
+ return data.latin1Slice(0, data.length)
+ },
+
+ utf16le: (data, sourceEncoding) => {
+ if (data.length === 0) {
+ return ''
+ }
+ if (typeof data === 'string') {
+ data = Buffer.from(data, sourceEncoding)
+ }
+ return data.ucs2Slice(0, data.length)
+ },
+
+ base64: (data, sourceEncoding) => {
+ if (data.length === 0) {
+ return ''
+ }
+ if (typeof data === 'string') {
+ data = Buffer.from(data, sourceEncoding)
+ }
+ return data.base64Slice(0, data.length)
+ },
+
+ other: (data, sourceEncoding) => {
+ if (data.length === 0) {
+ return ''
+ }
+ if (typeof data === 'string') {
+ data = Buffer.from(data, sourceEncoding)
+ }
+
+ if (textDecoders.has(this.toString())) {
+ try {
+ return textDecoders.get(this).decode(data)
+ } catch {}
+ }
+ return typeof data === 'string'
+ ? data
+ : data.toString()
+ }
+}
+
+function decodeText (text, sourceEncoding, destEncoding) {
+ if (text) {
+ return getDecoder(destEncoding)(text, sourceEncoding)
+ }
+ return text
+}
+
+module.exports = decodeText
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/getLimit.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/getLimit.js
new file mode 100644
index 0000000..cb64fd6
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/getLimit.js
@@ -0,0 +1,16 @@
+'use strict'
+
+module.exports = function getLimit (limits, name, defaultLimit) {
+ if (
+ !limits ||
+ limits[name] === undefined ||
+ limits[name] === null
+ ) { return defaultLimit }
+
+ if (
+ typeof limits[name] !== 'number' ||
+ isNaN(limits[name])
+ ) { throw new TypeError('Limit ' + name + ' is not a valid number') }
+
+ return limits[name]
+}
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/parseParams.js b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/parseParams.js
new file mode 100644
index 0000000..1698e62
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/parseParams.js
@@ -0,0 +1,196 @@
+/* eslint-disable object-property-newline */
+'use strict'
+
+const decodeText = require('./decodeText')
+
+const RE_ENCODED = /%[a-fA-F0-9][a-fA-F0-9]/g
+
+const EncodedLookup = {
+ '%00': '\x00', '%01': '\x01', '%02': '\x02', '%03': '\x03', '%04': '\x04',
+ '%05': '\x05', '%06': '\x06', '%07': '\x07', '%08': '\x08', '%09': '\x09',
+ '%0a': '\x0a', '%0A': '\x0a', '%0b': '\x0b', '%0B': '\x0b', '%0c': '\x0c',
+ '%0C': '\x0c', '%0d': '\x0d', '%0D': '\x0d', '%0e': '\x0e', '%0E': '\x0e',
+ '%0f': '\x0f', '%0F': '\x0f', '%10': '\x10', '%11': '\x11', '%12': '\x12',
+ '%13': '\x13', '%14': '\x14', '%15': '\x15', '%16': '\x16', '%17': '\x17',
+ '%18': '\x18', '%19': '\x19', '%1a': '\x1a', '%1A': '\x1a', '%1b': '\x1b',
+ '%1B': '\x1b', '%1c': '\x1c', '%1C': '\x1c', '%1d': '\x1d', '%1D': '\x1d',
+ '%1e': '\x1e', '%1E': '\x1e', '%1f': '\x1f', '%1F': '\x1f', '%20': '\x20',
+ '%21': '\x21', '%22': '\x22', '%23': '\x23', '%24': '\x24', '%25': '\x25',
+ '%26': '\x26', '%27': '\x27', '%28': '\x28', '%29': '\x29', '%2a': '\x2a',
+ '%2A': '\x2a', '%2b': '\x2b', '%2B': '\x2b', '%2c': '\x2c', '%2C': '\x2c',
+ '%2d': '\x2d', '%2D': '\x2d', '%2e': '\x2e', '%2E': '\x2e', '%2f': '\x2f',
+ '%2F': '\x2f', '%30': '\x30', '%31': '\x31', '%32': '\x32', '%33': '\x33',
+ '%34': '\x34', '%35': '\x35', '%36': '\x36', '%37': '\x37', '%38': '\x38',
+ '%39': '\x39', '%3a': '\x3a', '%3A': '\x3a', '%3b': '\x3b', '%3B': '\x3b',
+ '%3c': '\x3c', '%3C': '\x3c', '%3d': '\x3d', '%3D': '\x3d', '%3e': '\x3e',
+ '%3E': '\x3e', '%3f': '\x3f', '%3F': '\x3f', '%40': '\x40', '%41': '\x41',
+ '%42': '\x42', '%43': '\x43', '%44': '\x44', '%45': '\x45', '%46': '\x46',
+ '%47': '\x47', '%48': '\x48', '%49': '\x49', '%4a': '\x4a', '%4A': '\x4a',
+ '%4b': '\x4b', '%4B': '\x4b', '%4c': '\x4c', '%4C': '\x4c', '%4d': '\x4d',
+ '%4D': '\x4d', '%4e': '\x4e', '%4E': '\x4e', '%4f': '\x4f', '%4F': '\x4f',
+ '%50': '\x50', '%51': '\x51', '%52': '\x52', '%53': '\x53', '%54': '\x54',
+ '%55': '\x55', '%56': '\x56', '%57': '\x57', '%58': '\x58', '%59': '\x59',
+ '%5a': '\x5a', '%5A': '\x5a', '%5b': '\x5b', '%5B': '\x5b', '%5c': '\x5c',
+ '%5C': '\x5c', '%5d': '\x5d', '%5D': '\x5d', '%5e': '\x5e', '%5E': '\x5e',
+ '%5f': '\x5f', '%5F': '\x5f', '%60': '\x60', '%61': '\x61', '%62': '\x62',
+ '%63': '\x63', '%64': '\x64', '%65': '\x65', '%66': '\x66', '%67': '\x67',
+ '%68': '\x68', '%69': '\x69', '%6a': '\x6a', '%6A': '\x6a', '%6b': '\x6b',
+ '%6B': '\x6b', '%6c': '\x6c', '%6C': '\x6c', '%6d': '\x6d', '%6D': '\x6d',
+ '%6e': '\x6e', '%6E': '\x6e', '%6f': '\x6f', '%6F': '\x6f', '%70': '\x70',
+ '%71': '\x71', '%72': '\x72', '%73': '\x73', '%74': '\x74', '%75': '\x75',
+ '%76': '\x76', '%77': '\x77', '%78': '\x78', '%79': '\x79', '%7a': '\x7a',
+ '%7A': '\x7a', '%7b': '\x7b', '%7B': '\x7b', '%7c': '\x7c', '%7C': '\x7c',
+ '%7d': '\x7d', '%7D': '\x7d', '%7e': '\x7e', '%7E': '\x7e', '%7f': '\x7f',
+ '%7F': '\x7f', '%80': '\x80', '%81': '\x81', '%82': '\x82', '%83': '\x83',
+ '%84': '\x84', '%85': '\x85', '%86': '\x86', '%87': '\x87', '%88': '\x88',
+ '%89': '\x89', '%8a': '\x8a', '%8A': '\x8a', '%8b': '\x8b', '%8B': '\x8b',
+ '%8c': '\x8c', '%8C': '\x8c', '%8d': '\x8d', '%8D': '\x8d', '%8e': '\x8e',
+ '%8E': '\x8e', '%8f': '\x8f', '%8F': '\x8f', '%90': '\x90', '%91': '\x91',
+ '%92': '\x92', '%93': '\x93', '%94': '\x94', '%95': '\x95', '%96': '\x96',
+ '%97': '\x97', '%98': '\x98', '%99': '\x99', '%9a': '\x9a', '%9A': '\x9a',
+ '%9b': '\x9b', '%9B': '\x9b', '%9c': '\x9c', '%9C': '\x9c', '%9d': '\x9d',
+ '%9D': '\x9d', '%9e': '\x9e', '%9E': '\x9e', '%9f': '\x9f', '%9F': '\x9f',
+ '%a0': '\xa0', '%A0': '\xa0', '%a1': '\xa1', '%A1': '\xa1', '%a2': '\xa2',
+ '%A2': '\xa2', '%a3': '\xa3', '%A3': '\xa3', '%a4': '\xa4', '%A4': '\xa4',
+ '%a5': '\xa5', '%A5': '\xa5', '%a6': '\xa6', '%A6': '\xa6', '%a7': '\xa7',
+ '%A7': '\xa7', '%a8': '\xa8', '%A8': '\xa8', '%a9': '\xa9', '%A9': '\xa9',
+ '%aa': '\xaa', '%Aa': '\xaa', '%aA': '\xaa', '%AA': '\xaa', '%ab': '\xab',
+ '%Ab': '\xab', '%aB': '\xab', '%AB': '\xab', '%ac': '\xac', '%Ac': '\xac',
+ '%aC': '\xac', '%AC': '\xac', '%ad': '\xad', '%Ad': '\xad', '%aD': '\xad',
+ '%AD': '\xad', '%ae': '\xae', '%Ae': '\xae', '%aE': '\xae', '%AE': '\xae',
+ '%af': '\xaf', '%Af': '\xaf', '%aF': '\xaf', '%AF': '\xaf', '%b0': '\xb0',
+ '%B0': '\xb0', '%b1': '\xb1', '%B1': '\xb1', '%b2': '\xb2', '%B2': '\xb2',
+ '%b3': '\xb3', '%B3': '\xb3', '%b4': '\xb4', '%B4': '\xb4', '%b5': '\xb5',
+ '%B5': '\xb5', '%b6': '\xb6', '%B6': '\xb6', '%b7': '\xb7', '%B7': '\xb7',
+ '%b8': '\xb8', '%B8': '\xb8', '%b9': '\xb9', '%B9': '\xb9', '%ba': '\xba',
+ '%Ba': '\xba', '%bA': '\xba', '%BA': '\xba', '%bb': '\xbb', '%Bb': '\xbb',
+ '%bB': '\xbb', '%BB': '\xbb', '%bc': '\xbc', '%Bc': '\xbc', '%bC': '\xbc',
+ '%BC': '\xbc', '%bd': '\xbd', '%Bd': '\xbd', '%bD': '\xbd', '%BD': '\xbd',
+ '%be': '\xbe', '%Be': '\xbe', '%bE': '\xbe', '%BE': '\xbe', '%bf': '\xbf',
+ '%Bf': '\xbf', '%bF': '\xbf', '%BF': '\xbf', '%c0': '\xc0', '%C0': '\xc0',
+ '%c1': '\xc1', '%C1': '\xc1', '%c2': '\xc2', '%C2': '\xc2', '%c3': '\xc3',
+ '%C3': '\xc3', '%c4': '\xc4', '%C4': '\xc4', '%c5': '\xc5', '%C5': '\xc5',
+ '%c6': '\xc6', '%C6': '\xc6', '%c7': '\xc7', '%C7': '\xc7', '%c8': '\xc8',
+ '%C8': '\xc8', '%c9': '\xc9', '%C9': '\xc9', '%ca': '\xca', '%Ca': '\xca',
+ '%cA': '\xca', '%CA': '\xca', '%cb': '\xcb', '%Cb': '\xcb', '%cB': '\xcb',
+ '%CB': '\xcb', '%cc': '\xcc', '%Cc': '\xcc', '%cC': '\xcc', '%CC': '\xcc',
+ '%cd': '\xcd', '%Cd': '\xcd', '%cD': '\xcd', '%CD': '\xcd', '%ce': '\xce',
+ '%Ce': '\xce', '%cE': '\xce', '%CE': '\xce', '%cf': '\xcf', '%Cf': '\xcf',
+ '%cF': '\xcf', '%CF': '\xcf', '%d0': '\xd0', '%D0': '\xd0', '%d1': '\xd1',
+ '%D1': '\xd1', '%d2': '\xd2', '%D2': '\xd2', '%d3': '\xd3', '%D3': '\xd3',
+ '%d4': '\xd4', '%D4': '\xd4', '%d5': '\xd5', '%D5': '\xd5', '%d6': '\xd6',
+ '%D6': '\xd6', '%d7': '\xd7', '%D7': '\xd7', '%d8': '\xd8', '%D8': '\xd8',
+ '%d9': '\xd9', '%D9': '\xd9', '%da': '\xda', '%Da': '\xda', '%dA': '\xda',
+ '%DA': '\xda', '%db': '\xdb', '%Db': '\xdb', '%dB': '\xdb', '%DB': '\xdb',
+ '%dc': '\xdc', '%Dc': '\xdc', '%dC': '\xdc', '%DC': '\xdc', '%dd': '\xdd',
+ '%Dd': '\xdd', '%dD': '\xdd', '%DD': '\xdd', '%de': '\xde', '%De': '\xde',
+ '%dE': '\xde', '%DE': '\xde', '%df': '\xdf', '%Df': '\xdf', '%dF': '\xdf',
+ '%DF': '\xdf', '%e0': '\xe0', '%E0': '\xe0', '%e1': '\xe1', '%E1': '\xe1',
+ '%e2': '\xe2', '%E2': '\xe2', '%e3': '\xe3', '%E3': '\xe3', '%e4': '\xe4',
+ '%E4': '\xe4', '%e5': '\xe5', '%E5': '\xe5', '%e6': '\xe6', '%E6': '\xe6',
+ '%e7': '\xe7', '%E7': '\xe7', '%e8': '\xe8', '%E8': '\xe8', '%e9': '\xe9',
+ '%E9': '\xe9', '%ea': '\xea', '%Ea': '\xea', '%eA': '\xea', '%EA': '\xea',
+ '%eb': '\xeb', '%Eb': '\xeb', '%eB': '\xeb', '%EB': '\xeb', '%ec': '\xec',
+ '%Ec': '\xec', '%eC': '\xec', '%EC': '\xec', '%ed': '\xed', '%Ed': '\xed',
+ '%eD': '\xed', '%ED': '\xed', '%ee': '\xee', '%Ee': '\xee', '%eE': '\xee',
+ '%EE': '\xee', '%ef': '\xef', '%Ef': '\xef', '%eF': '\xef', '%EF': '\xef',
+ '%f0': '\xf0', '%F0': '\xf0', '%f1': '\xf1', '%F1': '\xf1', '%f2': '\xf2',
+ '%F2': '\xf2', '%f3': '\xf3', '%F3': '\xf3', '%f4': '\xf4', '%F4': '\xf4',
+ '%f5': '\xf5', '%F5': '\xf5', '%f6': '\xf6', '%F6': '\xf6', '%f7': '\xf7',
+ '%F7': '\xf7', '%f8': '\xf8', '%F8': '\xf8', '%f9': '\xf9', '%F9': '\xf9',
+ '%fa': '\xfa', '%Fa': '\xfa', '%fA': '\xfa', '%FA': '\xfa', '%fb': '\xfb',
+ '%Fb': '\xfb', '%fB': '\xfb', '%FB': '\xfb', '%fc': '\xfc', '%Fc': '\xfc',
+ '%fC': '\xfc', '%FC': '\xfc', '%fd': '\xfd', '%Fd': '\xfd', '%fD': '\xfd',
+ '%FD': '\xfd', '%fe': '\xfe', '%Fe': '\xfe', '%fE': '\xfe', '%FE': '\xfe',
+ '%ff': '\xff', '%Ff': '\xff', '%fF': '\xff', '%FF': '\xff'
+}
+
+function encodedReplacer (match) {
+ return EncodedLookup[match]
+}
+
+const STATE_KEY = 0
+const STATE_VALUE = 1
+const STATE_CHARSET = 2
+const STATE_LANG = 3
+
+function parseParams (str) {
+ const res = []
+ let state = STATE_KEY
+ let charset = ''
+ let inquote = false
+ let escaping = false
+ let p = 0
+ let tmp = ''
+ const len = str.length
+
+ for (var i = 0; i < len; ++i) { // eslint-disable-line no-var
+ const char = str[i]
+ if (char === '\\' && inquote) {
+ if (escaping) { escaping = false } else {
+ escaping = true
+ continue
+ }
+ } else if (char === '"') {
+ if (!escaping) {
+ if (inquote) {
+ inquote = false
+ state = STATE_KEY
+ } else { inquote = true }
+ continue
+ } else { escaping = false }
+ } else {
+ if (escaping && inquote) { tmp += '\\' }
+ escaping = false
+ if ((state === STATE_CHARSET || state === STATE_LANG) && char === "'") {
+ if (state === STATE_CHARSET) {
+ state = STATE_LANG
+ charset = tmp.substring(1)
+ } else { state = STATE_VALUE }
+ tmp = ''
+ continue
+ } else if (state === STATE_KEY &&
+ (char === '*' || char === '=') &&
+ res.length) {
+ state = char === '*'
+ ? STATE_CHARSET
+ : STATE_VALUE
+ res[p] = [tmp, undefined]
+ tmp = ''
+ continue
+ } else if (!inquote && char === ';') {
+ state = STATE_KEY
+ if (charset) {
+ if (tmp.length) {
+ tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
+ 'binary',
+ charset)
+ }
+ charset = ''
+ } else if (tmp.length) {
+ tmp = decodeText(tmp, 'binary', 'utf8')
+ }
+ if (res[p] === undefined) { res[p] = tmp } else { res[p][1] = tmp }
+ tmp = ''
+ ++p
+ continue
+ } else if (!inquote && (char === ' ' || char === '\t')) { continue }
+ }
+ tmp += char
+ }
+ if (charset && tmp.length) {
+ tmp = decodeText(tmp.replace(RE_ENCODED, encodedReplacer),
+ 'binary',
+ charset)
+ } else if (tmp) {
+ tmp = decodeText(tmp, 'binary', 'utf8')
+ }
+
+ if (res[p] === undefined) {
+ if (tmp) { res[p] = tmp }
+ } else { res[p][1] = tmp }
+
+ return res
+}
+
+module.exports = parseParams
diff --git a/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/package.json b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/package.json
new file mode 100644
index 0000000..83693ac
--- /dev/null
+++ b/node_modules/.deno/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/package.json
@@ -0,0 +1,86 @@
+{
+ "name": "@fastify/busboy",
+ "version": "2.1.1",
+ "private": false,
+ "author": "Brian White ",
+ "contributors": [
+ {
+ "name": "Igor Savin",
+ "email": "kibertoad@gmail.com",
+ "url": "https://github.com/kibertoad"
+ },
+ {
+ "name": "Aras Abbasi",
+ "email": "aras.abbasi@gmail.com",
+ "url": "https://github.com/uzlopak"
+ }
+ ],
+ "description": "A streaming parser for HTML form data for node.js",
+ "main": "lib/main",
+ "type": "commonjs",
+ "types": "lib/main.d.ts",
+ "scripts": {
+ "bench:busboy": "cd benchmarks && npm install && npm run benchmark-fastify",
+ "bench:dicer": "node bench/dicer/dicer-bench-multipart-parser.js",
+ "coveralls": "nyc report --reporter=lcov",
+ "lint": "npm run lint:standard",
+ "lint:everything": "npm run lint && npm run test:types",
+ "lint:fix": "standard --fix",
+ "lint:standard": "standard --verbose | snazzy",
+ "test:mocha": "tap",
+ "test:types": "tsd",
+ "test:coverage": "nyc npm run test",
+ "test": "npm run test:mocha"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "devDependencies": {
+ "@types/node": "^20.1.0",
+ "busboy": "^1.0.0",
+ "photofinish": "^1.8.0",
+ "snazzy": "^9.0.0",
+ "standard": "^17.0.0",
+ "tap": "^16.3.8",
+ "tinybench": "^2.5.1",
+ "tsd": "^0.30.0",
+ "typescript": "^5.0.2"
+ },
+ "keywords": [
+ "uploads",
+ "forms",
+ "multipart",
+ "form-data"
+ ],
+ "license": "MIT",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/fastify/busboy.git"
+ },
+ "tsd": {
+ "directory": "test/types",
+ "compilerOptions": {
+ "esModuleInterop": false,
+ "module": "commonjs",
+ "target": "ES2017"
+ }
+ },
+ "standard": {
+ "globals": [
+ "describe",
+ "it"
+ ],
+ "ignore": [
+ "bench"
+ ]
+ },
+ "files": [
+ "README.md",
+ "LICENSE",
+ "lib/*",
+ "deps/encoding/*",
+ "deps/dicer/lib",
+ "deps/streamsearch/",
+ "deps/dicer/LICENSE"
+ ]
+}
diff --git a/node_modules/.deno/@types+node@20.16.5/.initialized b/node_modules/.deno/@types+node@20.16.5/.initialized
new file mode 100644
index 0000000..e69de29
diff --git a/node_modules/@types/node/LICENSE b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/LICENSE
old mode 100755
new mode 100644
similarity index 100%
rename from node_modules/@types/node/LICENSE
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/LICENSE
diff --git a/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/README.md b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/README.md
new file mode 100644
index 0000000..e2e090a
--- /dev/null
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/README.md
@@ -0,0 +1,15 @@
+# Installation
+> `npm install --save @types/node`
+
+# Summary
+This package contains type definitions for node (https://nodejs.org/).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node/v20.
+
+### Additional Details
+ * Last updated: Wed, 04 Sep 2024 21:35:57 GMT
+ * Dependencies: [undici-types](https://npmjs.com/package/undici-types)
+
+# Credits
+These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky).
diff --git a/node_modules/@types/node/ts4.8/assert.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert.d.ts
old mode 100755
new mode 100644
similarity index 68%
rename from node_modules/@types/node/ts4.8/assert.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert.d.ts
index 9f916c1..4e465c5
--- a/node_modules/@types/node/ts4.8/assert.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert.d.ts
@@ -1,9 +1,9 @@
/**
- * The `assert` module provides a set of assertion functions for verifying
+ * The `node:assert` module provides a set of assertion functions for verifying
* invariants.
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/assert.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/assert.js)
*/
-declare module 'assert' {
+declare module "assert" {
/**
* An alias of {@link ok}.
* @since v0.5.9
@@ -12,15 +12,29 @@ declare module 'assert' {
function assert(value: unknown, message?: string | Error): asserts value;
namespace assert {
/**
- * Indicates the failure of an assertion. All errors thrown by the `assert` module
- * will be instances of the `AssertionError` class.
+ * Indicates the failure of an assertion. All errors thrown by the `node:assert` module will be instances of the `AssertionError` class.
*/
class AssertionError extends Error {
+ /**
+ * Set to the `actual` argument for methods such as {@link assert.strictEqual()}.
+ */
actual: unknown;
+ /**
+ * Set to the `expected` argument for methods such as {@link assert.strictEqual()}.
+ */
expected: unknown;
+ /**
+ * Set to the passed in operator value.
+ */
operator: string;
+ /**
+ * Indicates if the message was auto-generated (`true`) or not.
+ */
generatedMessage: boolean;
- code: 'ERR_ASSERTION';
+ /**
+ * Value is always `ERR_ASSERTION` to show that the error is an assertion error.
+ */
+ code: "ERR_ASSERTION";
constructor(options?: {
/** If provided, the error message is set to this value. */
message?: string | undefined;
@@ -31,14 +45,15 @@ declare module 'assert' {
/** The `operator` property on the error instance. */
operator?: string | undefined;
/** If provided, the generated stack trace omits frames before this function. */
- // tslint:disable-next-line:ban-types
+ // eslint-disable-next-line @typescript-eslint/ban-types
stackStartFn?: Function | undefined;
});
}
/**
- * This feature is currently experimental and behavior might still change.
+ * This feature is deprecated and will be removed in a future version.
+ * Please consider using alternatives such as the `mock` helper function.
* @since v14.2.0, v12.19.0
- * @experimental
+ * @deprecated Deprecated
*/
class CallTracker {
/**
@@ -47,7 +62,7 @@ declare module 'assert' {
* error.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@@ -61,30 +76,47 @@ declare module 'assert' {
* @since v14.2.0, v12.19.0
* @param [fn='A no-op function']
* @param [exact=1]
- * @return that wraps `fn`.
+ * @return A function that wraps `fn`.
*/
calls(exact?: number): () => void;
calls any>(fn?: Func, exact?: number): Func;
+ /**
+ * Example:
+ *
+ * ```js
+ * import assert from 'node:assert';
+ *
+ * const tracker = new assert.CallTracker();
+ *
+ * function func() {}
+ * const callsfunc = tracker.calls(func);
+ * callsfunc(1, 2, 3);
+ *
+ * assert.deepStrictEqual(tracker.getCalls(callsfunc),
+ * [{ thisArg: undefined, arguments: [1, 2, 3] }]);
+ * ```
+ * @since v18.8.0, v16.18.0
+ * @return An array with all the calls to a tracked function.
+ */
+ getCalls(fn: Function): CallTrackerCall[];
/**
* The arrays contains information about the expected and actual number of calls of
* the functions that have not been called the expected number of times.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
*
* function func() {}
*
- * function foo() {}
- *
* // Returns a function that wraps func() that must be called exact times
* // before tracker.verify().
* const callsfunc = tracker.calls(func, 2);
*
* // Returns an array containing information on callsfunc()
- * tracker.report();
+ * console.log(tracker.report());
* // [
* // {
* // message: 'Expected the func function to be executed 2 time(s) but was
@@ -97,15 +129,38 @@ declare module 'assert' {
* // ]
* ```
* @since v14.2.0, v12.19.0
- * @return of objects containing information about the wrapper functions returned by `calls`.
+ * @return An array of objects containing information about the wrapper functions returned by {@link tracker.calls()}.
*/
report(): CallTrackerReportInformation[];
/**
- * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that
+ * Reset calls of the call tracker. If a tracked function is passed as an argument, the calls will be reset for it.
+ * If no arguments are passed, all tracked functions will be reset.
+ *
+ * ```js
+ * import assert from 'node:assert';
+ *
+ * const tracker = new assert.CallTracker();
+ *
+ * function func() {}
+ * const callsfunc = tracker.calls(func);
+ *
+ * callsfunc();
+ * // Tracker was called once
+ * assert.strictEqual(tracker.getCalls(callsfunc).length, 1);
+ *
+ * tracker.reset(callsfunc);
+ * assert.strictEqual(tracker.getCalls(callsfunc).length, 0);
+ * ```
+ * @since v18.8.0, v16.18.0
+ * @param fn a tracked function to reset.
+ */
+ reset(fn?: Function): void;
+ /**
+ * Iterates through the list of functions passed to {@link tracker.calls()} and will throw an error for functions that
* have not been called the expected number of times.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* // Creates call tracker.
* const tracker = new assert.CallTracker();
@@ -125,6 +180,10 @@ declare module 'assert' {
*/
verify(): void;
}
+ interface CallTrackerCall {
+ thisArg: object;
+ arguments: unknown[];
+ }
interface CallTrackerReportInformation {
message: string;
/** The actual number of times the function was called. */
@@ -136,14 +195,14 @@ declare module 'assert' {
/** A stack trace of the function. */
stack: object;
}
- type AssertPredicate = RegExp | (new () => object) | ((thrown: unknown) => boolean) | object | Error;
+ type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error;
/**
* Throws an `AssertionError` with the provided error message or a default
* error message. If the `message` parameter is an instance of an `Error` then
* it will be thrown instead of the `AssertionError`.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.fail();
* // AssertionError [ERR_ASSERTION]: Failed
@@ -167,21 +226,21 @@ declare module 'assert' {
expected: unknown,
message?: string | Error,
operator?: string,
- // tslint:disable-next-line:ban-types
- stackStartFn?: Function
+ // eslint-disable-next-line @typescript-eslint/ban-types
+ stackStartFn?: Function,
): never;
/**
- * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`.
+ * Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
- * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default
- * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
+ * If `value` is not truthy, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is `undefined`, a default
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``.
*
* Be aware that in the `repl` the error message will be different to the one
* thrown in a file! See below for further details.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.ok(true);
* // OK
@@ -216,7 +275,7 @@ declare module 'assert' {
* ```
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* // Using `assert()` works the same:
* assert(0);
@@ -237,11 +296,11 @@ declare module 'assert' {
* > Stability: 3 - Legacy: Use {@link strictEqual} instead.
*
* Tests shallow, coercive equality between the `actual` and `expected` parameters
- * using the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison) ( `==` ). `NaN` is special handled
- * and treated as being identical in case both sides are `NaN`.
+ * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled
+ * and treated as being identical if both sides are `NaN`.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* assert.equal(1, 1);
* // OK, 1 == 1
@@ -256,8 +315,8 @@ declare module 'assert' {
* // AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
* ```
*
- * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default
- * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
+ * If the values are not equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* @since v0.1.21
*/
function equal(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -270,12 +329,11 @@ declare module 'assert' {
*
* > Stability: 3 - Legacy: Use {@link notStrictEqual} instead.
*
- * Tests shallow, coercive inequality with the [Abstract Equality Comparison](https://tc39.github.io/ecma262/#sec-abstract-equality-comparison)(`!=` ). `NaN` is special handled and treated as
- * being identical in case both
- * sides are `NaN`.
+ * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is
+ * specially handled and treated as being identical if both sides are `NaN`.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* assert.notEqual(1, 2);
* // OK
@@ -287,8 +345,8 @@ declare module 'assert' {
* // AssertionError: 1 != '1'
* ```
*
- * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error
- * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`.
+ * If the values are equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default error
+ * message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown instead of the `AssertionError`.
* @since v0.1.21
*/
function notEqual(actual: unknown, expected: unknown, message?: string | Error): void;
@@ -322,24 +380,24 @@ declare module 'assert' {
* Tests for any deep inequality. Opposite of {@link deepEqual}.
*
* ```js
- * import assert from 'assert';
+ * 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);
+ * const obj4 = { __proto__: obj1 };
*
* assert.notDeepEqual(obj1, obj1);
* // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } }
@@ -354,18 +412,18 @@ declare module 'assert' {
* // OK
* ```
*
- * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default
- * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
+ * If the values are deeply equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a default
+ * error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void;
/**
* Tests strict equality between the `actual` and `expected` parameters as
- * determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
+ * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.strictEqual(1, 2);
* // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal:
@@ -392,18 +450,18 @@ declare module 'assert' {
* // TypeError: Inputs are not identical
* ```
*
- * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
- * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
+ * If the values are not strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
+ * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T;
/**
* Tests strict inequality between the `actual` and `expected` parameters as
- * determined by the [SameValue Comparison](https://tc39.github.io/ecma262/#sec-samevalue).
+ * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is).
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.notStrictEqual(1, 2);
* // OK
@@ -417,8 +475,8 @@ declare module 'assert' {
* // OK
* ```
*
- * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a
- * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown
+ * If the values are strictly equal, an `AssertionError` is thrown with a `message` property set equal to the value of the `message` parameter. If the `message` parameter is undefined, a
+ * default error message is assigned. If the `message` parameter is an instance of an `Error` then it will be thrown
* instead of the `AssertionError`.
* @since v0.1.21
*/
@@ -434,7 +492,7 @@ declare module 'assert' {
* Tests for deep strict inequality. Opposite of {@link deepStrictEqual}.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
* // OK
@@ -459,20 +517,20 @@ declare module 'assert' {
* using an object, it is also possible to use a regular expression, when
* validating against a string property. See below for examples.
*
- * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation
+ * If specified, `message` will be appended to the message provided by the `AssertionError` if the `fn` call fails to throw or in case the error validation
* fails.
*
* Custom validation object/error instance:
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* const err = new TypeError('Wrong value');
* err.code = 404;
* err.foo = 'bar';
* err.info = {
* nested: true,
- * baz: 'text'
+ * baz: 'text',
* };
* err.reg = /abc/i;
*
@@ -485,16 +543,16 @@ declare module 'assert' {
* 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:
- * throws(
+ * assert.throws(
* () => {
* throw err;
* },
@@ -508,17 +566,17 @@ declare module 'assert' {
* 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:
- * throws(
+ * assert.throws(
* () => {
* const otherErr = new Error('Not found');
* // Copy all enumerable properties from `err` to `otherErr`.
@@ -529,20 +587,20 @@ declare module 'assert' {
* },
* // The error's `message` and `name` properties will also be checked when using
* // an error as validation object.
- * err
+ * err,
* );
* ```
*
* Validate instanceof using constructor:
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
- * Error
+ * Error,
* );
* ```
*
@@ -552,13 +610,13 @@ declare module 'assert' {
* therefore also include the error name.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
* throw new Error('Wrong value');
* },
- * /^Error: Wrong value$/
+ * /^Error: Wrong value$/,
* );
* ```
*
@@ -568,7 +626,7 @@ declare module 'assert' {
* It will otherwise fail with an `AssertionError`.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.throws(
* () => {
@@ -584,17 +642,17 @@ declare module 'assert' {
* // possible.
* return true;
* },
- * 'unexpected error'
+ * 'unexpected error',
* );
* ```
*
* `error` cannot be a string. If a string is provided as the second
- * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same
- * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
+ * argument, then `error` is assumed to be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Using the same
+ * message as the thrown error message is going to result in an `ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using
* a string as the second argument gets considered:
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* function throwingFirst() {
* throw new Error('First');
@@ -643,27 +701,27 @@ declare module 'assert' {
* adding a comment next to the specific code path that should not throw and keep
* error messages as expressive as possible.
*
- * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function.
+ * When `assert.doesNotThrow()` is called, it will immediately call the `fn` function.
*
- * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a
+ * If an error is thrown and it is the same type as that specified by the `error` parameter, then an `AssertionError` is thrown. If the error is of a
* different type, or if the `error` parameter is undefined, the error is
* propagated back to the caller.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
+ * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.
*
* The following, for instance, will throw the `TypeError` because there is no
* matching error type in the assertion:
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
- * SyntaxError
+ * SyntaxError,
* );
* ```
*
@@ -671,27 +729,27 @@ declare module 'assert' {
* 'Got unwanted exception...':
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
- * TypeError
+ * TypeError,
* );
* ```
*
- * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message:
+ * If an `AssertionError` is thrown and a value is provided for the `message` parameter, the value of `message` will be appended to the `AssertionError` message:
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.doesNotThrow(
* () => {
* throw new TypeError('Wrong value');
* },
* /Wrong value/,
- * 'Whoops'
+ * 'Whoops',
* );
* // Throws: AssertionError: Got unwanted exception: Whoops
* ```
@@ -702,10 +760,10 @@ declare module 'assert' {
/**
* Throws `value` if `value` is not `undefined` or `null`. This is useful when
* testing the `error` argument in callbacks. The stack trace contains all frames
- * from the error passed to `ifError()` including the potential new frames for`ifError()` itself.
+ * from the error passed to `ifError()` including the potential new frames for `ifError()` itself.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.ifError(null);
* // OK
@@ -737,21 +795,21 @@ declare module 'assert' {
* calls the function and awaits the returned promise to complete. It will then
* check that the promise is rejected.
*
- * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the
- * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error
- * handler is skipped.
+ * If `asyncFn` is a function and it throws an error synchronously, `assert.rejects()` will return a rejected `Promise` with that error. If the
+ * function does not return a promise, `assert.rejects()` will return a rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value)
+ * error. In both cases the error handler is skipped.
*
* Besides the async nature to await the completion behaves identically to {@link throws}.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
* [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function,
* an object where each property will be tested for, or an instance of error where
- * each property will be tested for including the non-enumerable `message` and`name` properties.
+ * each property will be tested for including the non-enumerable `message` and `name` properties.
*
- * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject.
+ * If specified, `message` will be the message provided by the `{@link AssertionError}` if the `asyncFn` fails to reject.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* await assert.rejects(
* async () => {
@@ -759,13 +817,13 @@ declare module 'assert' {
* },
* {
* name: 'TypeError',
- * message: 'Wrong value'
- * }
+ * message: 'Wrong value',
+ * },
* );
* ```
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* await assert.rejects(
* async () => {
@@ -775,37 +833,40 @@ declare module 'assert' {
* assert.strictEqual(err.name, 'TypeError');
* assert.strictEqual(err.message, 'Wrong value');
* return true;
- * }
+ * },
* );
* ```
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.rejects(
* Promise.reject(new Error('Wrong value')),
- * Error
+ * Error,
* ).then(() => {
* // ...
* });
* ```
*
- * `error` cannot be a string. If a string is provided as the second
- * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the
- * example in {@link throws} carefully if using a string as the second
- * argument gets considered.
+ * `error` cannot be a string. If a string is provided as the second argument, then `error` is assumed to
+ * be omitted and the string will be used for `message` instead. This can lead to easy-to-miss mistakes. Please read the
+ * example in {@link throws} carefully if using a string as the second argument gets considered.
* @since v10.0.0
*/
function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise;
- function rejects(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise;
+ function rejects(
+ block: (() => Promise) | Promise,
+ error: AssertPredicate,
+ message?: string | Error,
+ ): Promise;
/**
* Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately
* calls the function and awaits the returned promise to complete. It will then
* check that the promise is not rejected.
*
- * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If
+ * If `asyncFn` is a function and it throws an error synchronously, `assert.doesNotReject()` will return a rejected `Promise` with that error. If
* the function does not return a promise, `assert.doesNotReject()` will return a
- * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases
+ * rejected `Promise` with an [ERR_INVALID_RETURN_VALUE](https://nodejs.org/docs/latest-v20.x/api/errors.html#err_invalid_return_value) error. In both cases
* the error handler is skipped.
*
* Using `assert.doesNotReject()` is actually not useful because there is little
@@ -814,24 +875,24 @@ declare module 'assert' {
* error messages as expressive as possible.
*
* If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes),
- * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) or a validation
+ * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation
* function. See {@link throws} for more details.
*
* Besides the async nature to await the completion behaves identically to {@link doesNotThrow}.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* await assert.doesNotReject(
* async () => {
* throw new TypeError('Wrong value');
* },
- * SyntaxError
+ * SyntaxError,
* );
* ```
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.doesNotReject(Promise.reject(new TypeError('Wrong value')))
* .then(() => {
@@ -840,13 +901,20 @@ declare module 'assert' {
* ```
* @since v10.0.0
*/
- function doesNotReject(block: (() => Promise) | Promise, message?: string | Error): Promise;
- function doesNotReject(block: (() => Promise) | Promise, error: AssertPredicate, message?: string | Error): Promise;
+ function doesNotReject(
+ block: (() => Promise) | Promise,
+ message?: string | Error,
+ ): Promise;
+ function doesNotReject(
+ block: (() => Promise) | Promise,
+ error: AssertPredicate,
+ message?: string | Error,
+ ): Promise;
/**
* Expects the `string` input to match the regular expression.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.match('I will fail', /pass/);
* // AssertionError [ERR_ASSERTION]: The input did not match the regular ...
@@ -858,10 +926,10 @@ declare module 'assert' {
* // OK
* ```
*
- * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
+ * If the values do not match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
- * instance of an `Error` then it will be thrown instead of the `AssertionError`.
+ * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function match(value: string, regExp: RegExp, message?: string | Error): void;
@@ -869,7 +937,7 @@ declare module 'assert' {
* Expects the `string` input not to match the regular expression.
*
* ```js
- * import assert from 'assert/strict';
+ * import assert from 'node:assert/strict';
*
* assert.doesNotMatch('I will fail', /fail/);
* // AssertionError [ERR_ASSERTION]: The input was expected to not match the ...
@@ -881,32 +949,92 @@ declare module 'assert' {
* // OK
* ```
*
- * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal
+ * If the values do match, or if the `string` argument is of another type than `string`, an `{@link AssertionError}` is thrown with a `message` property set equal
* to the value of the `message` parameter. If the `message` parameter is
* undefined, a default error message is assigned. If the `message` parameter is an
- * instance of an `Error` then it will be thrown instead of the `AssertionError`.
+ * instance of an [Error](https://nodejs.org/docs/latest-v20.x/api/errors.html#class-error) then it will be thrown instead of the `{@link AssertionError}`.
* @since v13.6.0, v12.16.0
*/
function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void;
- const strict: Omit & {
- (value: unknown, message?: string | Error): asserts value;
- equal: typeof strictEqual;
- notEqual: typeof notStrictEqual;
- deepEqual: typeof deepStrictEqual;
- notDeepEqual: typeof notDeepStrictEqual;
- // Mapped types and assertion functions are incompatible?
- // TS2775: Assertions require every name in the call target
- // to be declared with an explicit type annotation.
- ok: typeof ok;
- strictEqual: typeof strictEqual;
- deepStrictEqual: typeof deepStrictEqual;
- ifError: typeof ifError;
- strict: typeof strict;
- };
+ /**
+ * In strict assertion mode, non-strict methods behave like their corresponding strict methods. For example,
+ * {@link deepEqual} will behave like {@link deepStrictEqual}.
+ *
+ * In strict assertion mode, error messages for objects display a diff. In legacy assertion mode, error
+ * messages for objects display the objects, often truncated.
+ *
+ * To use strict assertion mode:
+ *
+ * ```js
+ * import { strict as assert } from 'node:assert';COPY
+ * import assert from 'node:assert/strict';
+ * ```
+ *
+ * Example error diff:
+ *
+ * ```js
+ * import { strict as assert } from 'node:assert';
+ *
+ * assert.deepEqual([[[1, 2, 3]], 4, 5], [[[1, 2, '3']], 4, 5]);
+ * // AssertionError: Expected inputs to be strictly deep-equal:
+ * // + actual - expected ... Lines skipped
+ * //
+ * // [
+ * // [
+ * // ...
+ * // 2,
+ * // + 3
+ * // - '3'
+ * // ],
+ * // ...
+ * // 5
+ * // ]
+ * ```
+ *
+ * To deactivate the colors, use the `NO_COLOR` or `NODE_DISABLE_COLORS` environment variables. This will also
+ * deactivate the colors in the REPL. For more on color support in terminal environments, read the tty
+ * `getColorDepth()` documentation.
+ *
+ * @since v15.0.0, v13.9.0, v12.16.2, v9.9.0
+ */
+ namespace strict {
+ type AssertionError = assert.AssertionError;
+ type AssertPredicate = assert.AssertPredicate;
+ type CallTrackerCall = assert.CallTrackerCall;
+ type CallTrackerReportInformation = assert.CallTrackerReportInformation;
+ }
+ const strict:
+ & Omit<
+ typeof assert,
+ | "equal"
+ | "notEqual"
+ | "deepEqual"
+ | "notDeepEqual"
+ | "ok"
+ | "strictEqual"
+ | "deepStrictEqual"
+ | "ifError"
+ | "strict"
+ >
+ & {
+ (value: unknown, message?: string | Error): asserts value;
+ equal: typeof strictEqual;
+ notEqual: typeof notStrictEqual;
+ deepEqual: typeof deepStrictEqual;
+ notDeepEqual: typeof notDeepStrictEqual;
+ // Mapped types and assertion functions are incompatible?
+ // TS2775: Assertions require every name in the call target
+ // to be declared with an explicit type annotation.
+ ok: typeof ok;
+ strictEqual: typeof strictEqual;
+ deepStrictEqual: typeof deepStrictEqual;
+ ifError: typeof ifError;
+ strict: typeof strict;
+ };
}
export = assert;
}
-declare module 'node:assert' {
- import assert = require('assert');
+declare module "node:assert" {
+ import assert = require("assert");
export = assert;
}
diff --git a/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert/strict.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert/strict.d.ts
new file mode 100644
index 0000000..f333913
--- /dev/null
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/assert/strict.d.ts
@@ -0,0 +1,8 @@
+declare module "assert/strict" {
+ import { strict } from "node:assert";
+ export = strict;
+}
+declare module "node:assert/strict" {
+ import { strict } from "node:assert";
+ export = strict;
+}
diff --git a/node_modules/@types/node/async_hooks.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/async_hooks.d.ts
old mode 100755
new mode 100644
similarity index 78%
rename from node_modules/@types/node/async_hooks.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/async_hooks.d.ts
index ed294eb..f5432e2
--- a/node_modules/@types/node/async_hooks.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/async_hooks.d.ts
@@ -1,19 +1,27 @@
/**
- * The `async_hooks` module provides an API to track asynchronous resources. It
- * can be accessed using:
+ * We strongly discourage the use of the `async_hooks` API.
+ * Other APIs that can cover most of its use cases include:
+ *
+ * * [`AsyncLocalStorage`](https://nodejs.org/docs/latest-v20.x/api/async_context.html#class-asynclocalstorage) tracks async context
+ * * [`process.getActiveResourcesInfo()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processgetactiveresourcesinfo) tracks active resources
+ *
+ * The `node:async_hooks` module provides an API to track asynchronous resources.
+ * It can be accessed using:
*
* ```js
- * import async_hooks from 'async_hooks';
+ * import async_hooks from 'node:async_hooks';
* ```
* @experimental
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/async_hooks.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/async_hooks.js)
*/
-declare module 'async_hooks' {
+declare module "async_hooks" {
/**
* ```js
- * import { executionAsyncId } from 'async_hooks';
+ * import { executionAsyncId } from 'node:async_hooks';
+ * import fs from 'node:fs';
*
* console.log(executionAsyncId()); // 1 - bootstrap
+ * const path = '.';
* fs.open(path, 'r', (err, fd) => {
* console.log(executionAsyncId()); // 6 - open()
* });
@@ -36,7 +44,7 @@ declare module 'async_hooks' {
* ```
*
* Promise contexts may not get precise `executionAsyncIds` by default.
- * See the section on `promise execution tracking`.
+ * See the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @since v8.1.0
* @return The `asyncId` of the current execution context. Useful to track when something calls.
*/
@@ -51,8 +59,8 @@ declare module 'async_hooks' {
* but having an object representing the top-level can be helpful.
*
* ```js
- * import { open } from 'fs';
- * import { executionAsyncId, executionAsyncResource } from 'async_hooks';
+ * import { open } from 'node:fs';
+ * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks';
*
* console.log(executionAsyncId(), executionAsyncResource()); // 1 {}
* open(new URL(import.meta.url), 'r', (err, fd) => {
@@ -64,11 +72,11 @@ declare module 'async_hooks' {
* use of a tracking `Map` to store the metadata:
*
* ```js
- * import { createServer } from 'http';
+ * import { createServer } from 'node:http';
* import {
* executionAsyncId,
* executionAsyncResource,
- * createHook
+ * createHook,
* } from 'async_hooks';
* const sym = Symbol('state'); // Private symbol to avoid pollution
*
@@ -78,7 +86,7 @@ declare module 'async_hooks' {
* if (cr) {
* resource[sym] = cr[sym];
* }
- * }
+ * },
* }).enable();
*
* const server = createServer((req, res) => {
@@ -109,17 +117,17 @@ declare module 'async_hooks' {
* ```
*
* Promise contexts may not get valid `triggerAsyncId`s by default. See
- * the section on `promise execution tracking`.
+ * the section on [promise execution tracking](https://nodejs.org/docs/latest-v20.x/api/async_hooks.html#promise-execution-tracking).
* @return The ID of the resource responsible for calling the callback that is currently being executed.
*/
function triggerAsyncId(): number;
interface HookCallbacks {
/**
* Called when a class is constructed that has the possibility to emit an asynchronous event.
- * @param asyncId a unique ID for the async resource
- * @param type the type of the async resource
- * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created
- * @param resource reference to the resource representing the async operation, needs to be released during destroy
+ * @param asyncId A unique ID for the async resource
+ * @param type The type of the async resource
+ * @param triggerAsyncId The unique ID of the async resource in whose execution context this async resource was created
+ * @param resource Reference to the resource representing the async operation, needs to be released during destroy
*/
init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void;
/**
@@ -129,7 +137,9 @@ declare module 'async_hooks' {
*/
before?(asyncId: number): void;
/**
- * Called immediately after the callback specified in before is completed.
+ * Called immediately after the callback specified in `before` is completed.
+ *
+ * If an uncaught exception occurs during execution of the callback, then `after` will run after the `'uncaughtException'` event is emitted or a `domain`'s handler runs.
* @param asyncId the unique identifier assigned to the resource which has executed the callback.
*/
after?(asyncId: number): void;
@@ -167,11 +177,11 @@ declare module 'async_hooks' {
* specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section.
*
* ```js
- * import { createHook } from 'async_hooks';
+ * import { createHook } from 'node:async_hooks';
*
* const asyncHook = createHook({
* init(asyncId, type, triggerAsyncId, resource) { },
- * destroy(asyncId) { }
+ * destroy(asyncId) { },
* });
* ```
*
@@ -223,13 +233,13 @@ declare module 'async_hooks' {
* The following is an overview of the `AsyncResource` API.
*
* ```js
- * import { AsyncResource, executionAsyncId } from 'async_hooks';
+ * import { AsyncResource, executionAsyncId } from 'node:async_hooks';
*
* // AsyncResource() is meant to be extended. Instantiating a
* // 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
@@ -263,9 +273,6 @@ declare module 'async_hooks' {
constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions);
/**
* Binds the given function to the current execution context.
- *
- * The returned function will have an `asyncResource` property referencing
- * the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0
* @param fn The function to bind to the current execution context.
* @param type An optional name to associate with the underlying `AsyncResource`.
@@ -273,23 +280,14 @@ declare module 'async_hooks' {
static bind any, ThisArg>(
fn: Func,
type?: string,
- thisArg?: ThisArg
- ): Func & {
- asyncResource: AsyncResource;
- };
+ thisArg?: ThisArg,
+ ): Func;
/**
* Binds the given function to execute to this `AsyncResource`'s scope.
- *
- * The returned function will have an `asyncResource` property referencing
- * the `AsyncResource` to which the function is bound.
* @since v14.8.0, v12.19.0
* @param fn The function to bind to the current `AsyncResource`.
*/
- bind any>(
- fn: Func
- ): Func & {
- asyncResource: AsyncResource;
- };
+ bind any>(fn: Func): Func;
/**
* Call the provided function with the provided arguments in the execution context
* of the async resource. This will establish the context, trigger the AsyncHooks
@@ -300,7 +298,11 @@ declare module 'async_hooks' {
* @param thisArg The receiver to be used for the function call.
* @param args Optional arguments to pass to the function.
*/
- runInAsyncScope(fn: (this: This, ...args: any[]) => Result, thisArg?: This, ...args: any[]): Result;
+ runInAsyncScope(
+ fn: (this: This, ...args: any[]) => Result,
+ thisArg?: This,
+ ...args: any[]
+ ): Result;
/**
* Call all `destroy` hooks. This should only ever be called once. An error will
* be thrown if it is called more than once. This **must** be manually called. If
@@ -314,7 +316,6 @@ declare module 'async_hooks' {
*/
asyncId(): number;
/**
- *
* @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor.
*/
triggerAsyncId(): number;
@@ -322,17 +323,17 @@ declare module 'async_hooks' {
/**
* This class creates stores that stay coherent through asynchronous operations.
*
- * While you can create your own implementation on top of the `async_hooks` module,`AsyncLocalStorage` should be preferred as it is a performant and memory safe
- * implementation that involves significant optimizations that are non-obvious to
- * implement.
+ * While you can create your own implementation on top of the `node:async_hooks` module, `AsyncLocalStorage` should be preferred as it is a performant and memory
+ * safe implementation that involves significant optimizations that are non-obvious
+ * to implement.
*
* The following example uses `AsyncLocalStorage` to build a simple logger
* that assigns IDs to incoming HTTP requests and includes them in messages
* logged within each request.
*
* ```js
- * import http from 'http';
- * import { AsyncLocalStorage } from 'async_hooks';
+ * import http from 'node:http';
+ * import { AsyncLocalStorage } from 'node:async_hooks';
*
* const asyncLocalStorage = new AsyncLocalStorage();
*
@@ -364,18 +365,56 @@ declare module 'async_hooks' {
*
* Each instance of `AsyncLocalStorage` maintains an independent storage context.
* Multiple instances can safely exist simultaneously without risk of interfering
- * with each other data.
+ * with each other's data.
* @since v13.10.0, v12.17.0
*/
class AsyncLocalStorage {
+ /**
+ * Binds the given function to the current execution context.
+ * @since v19.8.0
+ * @experimental
+ * @param fn The function to bind to the current execution context.
+ * @return A new function that calls `fn` within the captured execution context.
+ */
+ static bind any>(fn: Func): Func;
+ /**
+ * Captures the current execution context and returns a function that accepts a
+ * function as an argument. Whenever the returned function is called, it
+ * calls the function passed to it within the captured context.
+ *
+ * ```js
+ * const asyncLocalStorage = new AsyncLocalStorage();
+ * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot());
+ * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore()));
+ * console.log(result); // returns 123
+ * ```
+ *
+ * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple
+ * async context tracking purposes, for example:
+ *
+ * ```js
+ * class Foo {
+ * #runInAsyncScope = AsyncLocalStorage.snapshot();
+ *
+ * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); }
+ * }
+ *
+ * const foo = asyncLocalStorage.run(123, () => new Foo());
+ * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123
+ * ```
+ * @since v19.8.0
+ * @experimental
+ * @return A new function with the signature `(fn: (...args) : R, ...args) : R`.
+ */
+ static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R;
/**
* Disables the instance of `AsyncLocalStorage`. All subsequent calls
- * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
+ * to `asyncLocalStorage.getStore()` will return `undefined` until `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again.
*
* When calling `asyncLocalStorage.disable()`, all current contexts linked to the
* instance will be exited.
*
- * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores
+ * Calling `asyncLocalStorage.disable()` is required before the `asyncLocalStorage` can be garbage collected. This does not apply to stores
* provided by the `asyncLocalStorage`, as those objects are garbage collected
* along with the corresponding async resources.
*
@@ -395,8 +434,9 @@ declare module 'async_hooks' {
getStore(): T | undefined;
/**
* Runs a function synchronously within a context and returns its
- * return value. The store is not accessible outside of the callback function or
- * the asynchronous operations created within the callback.
+ * return value. The store is not accessible outside of the callback function.
+ * The store is accessible to any asynchronous operations created within the
+ * callback.
*
* The optional `args` are passed to the callback function.
*
@@ -410,6 +450,9 @@ declare module 'async_hooks' {
* try {
* asyncLocalStorage.run(store, () => {
* asyncLocalStorage.getStore(); // Returns the store object
+ * setTimeout(() => {
+ * asyncLocalStorage.getStore(); // Returns the store object
+ * }, 200);
* throw new Error();
* });
* } catch (e) {
@@ -419,11 +462,12 @@ declare module 'async_hooks' {
* ```
* @since v13.10.0, v12.17.0
*/
+ run(store: T, callback: () => R): R;
run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R;
/**
* Runs a function synchronously outside of a context and returns its
* return value. The store is not accessible within the callback function or
- * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`.
+ * the asynchronous operations created within the callback. Any `getStore()` call done within the callback function will always return `undefined`.
*
* The optional `args` are passed to the callback function.
*
@@ -469,7 +513,7 @@ declare module 'async_hooks' {
* This transition will continue for the _entire_ synchronous execution.
* This means that if, for example, the context is entered within an event
* handler subsequent event handlers will also run within that context unless
- * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons
+ * specifically bound to another context with an `AsyncResource`. That is why `run()` should be preferred over `enterWith()` unless there are strong reasons
* to use the latter method.
*
* ```js
@@ -492,6 +536,6 @@ declare module 'async_hooks' {
enterWith(store: T): void;
}
}
-declare module 'node:async_hooks' {
- export * from 'async_hooks';
+declare module "node:async_hooks" {
+ export * from "async_hooks";
}
diff --git a/node_modules/@types/node/buffer.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/buffer.d.ts
old mode 100755
new mode 100644
similarity index 85%
rename from node_modules/@types/node/buffer.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/buffer.d.ts
index 1d9dd98..772db72
--- a/node_modules/@types/node/buffer.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/buffer.d.ts
@@ -1,3 +1,8 @@
+// If lib.dom.d.ts or lib.webworker.d.ts is loaded, then use the global types.
+// Otherwise, use the types from node.
+type _Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : import("buffer").Blob;
+type _File = typeof globalThis extends { onmessage: any; File: any } ? {} : import("buffer").File;
+
/**
* `Buffer` objects are used to represent a fixed-length sequence of bytes. Many
* Node.js APIs support `Buffer`s.
@@ -10,7 +15,7 @@
* recommended to explicitly reference it via an import or require statement.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Creates a zero-filled Buffer of length 10.
* const buf1 = Buffer.alloc(10);
@@ -41,11 +46,29 @@
* // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74].
* const buf7 = Buffer.from('tést', 'latin1');
* ```
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/buffer.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/buffer.js)
*/
-declare module 'buffer' {
- import { BinaryLike } from 'node:crypto';
- import { ReadableStream as WebReadableStream } from 'node:stream/web';
+declare module "buffer" {
+ import { BinaryLike } from "node:crypto";
+ import { ReadableStream as WebReadableStream } from "node:stream/web";
+ /**
+ * This function returns `true` if `input` contains only valid UTF-8-encoded data,
+ * including the case in which `input` is empty.
+ *
+ * Throws if the `input` is a detached array buffer.
+ * @since v19.4.0, v18.14.0
+ * @param input The input to validate.
+ */
+ export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
+ /**
+ * This function returns `true` if `input` contains only valid ASCII-encoded data,
+ * including the case in which `input` is empty.
+ *
+ * Throws if the `input` is a detached array buffer.
+ * @since v19.6.0, v18.15.0
+ * @param input The input to validate.
+ */
+ export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean;
export const INSPECT_MAX_BYTES: number;
export const kMaxLength: number;
export const kStringMaxLength: number;
@@ -53,7 +76,16 @@ declare module 'buffer' {
MAX_LENGTH: number;
MAX_STRING_LENGTH: number;
};
- export type TranscodeEncoding = 'ascii' | 'utf8' | 'utf16le' | 'ucs2' | 'latin1' | 'binary';
+ export type TranscodeEncoding =
+ | "ascii"
+ | "utf8"
+ | "utf-8"
+ | "utf16le"
+ | "utf-16le"
+ | "ucs2"
+ | "ucs-2"
+ | "latin1"
+ | "binary";
/**
* Re-encodes the given `Buffer` or `Uint8Array` instance from one character
* encoding to another. Returns a new `Buffer` instance.
@@ -61,13 +93,13 @@ declare module 'buffer' {
* Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if
* conversion from `fromEnc` to `toEnc` is not permitted.
*
- * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
+ * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`, `'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`.
*
* The transcoding process will use substitution characters if a given byte
* sequence cannot be adequately represented in the target encoding. For instance:
*
* ```js
- * import { Buffer, transcode } from 'buffer';
+ * import { Buffer, transcode } from 'node:buffer';
*
* const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii');
* console.log(newBuf.toString('ascii'));
@@ -84,7 +116,7 @@ declare module 'buffer' {
export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer;
export const SlowBuffer: {
/** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */
- new (size: number): Buffer;
+ new(size: number): Buffer;
prototype: Buffer;
};
/**
@@ -101,9 +133,10 @@ declare module 'buffer' {
*/
export interface BlobOptions {
/**
- * @default 'utf8'
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
+ * will be converted to the platform native line-ending as specified by `require('node:os').EOL`.
*/
- encoding?: BufferEncoding | undefined;
+ endings?: "transparent" | "native";
/**
* The Blob content-type. The intent is for `type` to convey
* the MIME media type of the data, however no validation of the type format
@@ -114,18 +147,17 @@ declare module 'buffer' {
/**
* A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across
* multiple worker threads.
- * @since v15.7.0
- * @experimental
+ * @since v15.7.0, v14.18.0
*/
export class Blob {
/**
* The total size of the `Blob` in bytes.
- * @since v15.7.0
+ * @since v15.7.0, v14.18.0
*/
readonly size: number;
/**
* The content-type of the `Blob`.
- * @since v15.7.0
+ * @since v15.7.0, v14.18.0
*/
readonly type: string;
/**
@@ -136,17 +168,29 @@ declare module 'buffer' {
*
* String sources are also copied into the `Blob`.
*/
- constructor(sources: Array, options?: BlobOptions);
+ constructor(sources: Array, options?: BlobOptions);
/**
* Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
* the `Blob` data.
- * @since v15.7.0
+ * @since v15.7.0, v14.18.0
*/
arrayBuffer(): Promise;
+ /**
+ * The `blob.bytes()` method returns the byte of the `Blob` object as a `Promise`.
+ *
+ * ```js
+ * const blob = new Blob(['hello']);
+ * blob.bytes().then((bytes) => {
+ * console.log(bytes); // Outputs: Uint8Array(5) [ 104, 101, 108, 108, 111 ]
+ * });
+ * ```
+ * @since v20.16.0
+ */
+ bytes(): Promise;
/**
* Creates and returns a new `Blob` containing a subset of this `Blob` objects
* data. The original `Blob` is not altered.
- * @since v15.7.0
+ * @since v15.7.0, v14.18.0
* @param start The starting index.
* @param end The ending index.
* @param type The content-type for the new `Blob`
@@ -155,25 +199,69 @@ declare module 'buffer' {
/**
* Returns a promise that fulfills with the contents of the `Blob` decoded as a
* UTF-8 string.
- * @since v15.7.0
+ * @since v15.7.0, v14.18.0
*/
text(): Promise;
/**
- * Returns a new (WHATWG) `ReadableStream` that allows the content of the `Blob` to be read.
+ * Returns a new `ReadableStream` that allows the content of the `Blob` to be read.
* @since v16.7.0
*/
stream(): WebReadableStream;
}
+ export interface FileOptions {
+ /**
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be
+ * converted to the platform native line-ending as specified by `require('node:os').EOL`.
+ */
+ endings?: "native" | "transparent";
+ /** The File content-type. */
+ type?: string;
+ /** The last modified date of the file. `Default`: Date.now(). */
+ lastModified?: number;
+ }
+ /**
+ * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files.
+ * @since v19.2.0, v18.13.0
+ */
+ export class File extends Blob {
+ constructor(sources: Array, fileName: string, options?: FileOptions);
+ /**
+ * The name of the `File`.
+ * @since v19.2.0, v18.13.0
+ */
+ readonly name: string;
+ /**
+ * The last modified date of the `File`.
+ * @since v19.2.0, v18.13.0
+ */
+ readonly lastModified: number;
+ }
export import atob = globalThis.atob;
export import btoa = globalThis.btoa;
+
global {
+ namespace NodeJS {
+ export { BufferEncoding };
+ }
// Buffer class
- type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
+ type BufferEncoding =
+ | "ascii"
+ | "utf8"
+ | "utf-8"
+ | "utf16le"
+ | "utf-16le"
+ | "ucs2"
+ | "ucs-2"
+ | "base64"
+ | "base64url"
+ | "latin1"
+ | "binary"
+ | "hex";
type WithImplicitCoercion =
| T
| {
- valueOf(): T;
- };
+ valueOf(): T;
+ };
/**
* Raw data is stored in instances of the Buffer class.
* A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized.
@@ -187,68 +275,75 @@ declare module 'buffer' {
* @param encoding encoding to use, optional. Default is 'utf8'
* @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead.
*/
- new (str: string, encoding?: BufferEncoding): Buffer;
+ new(str: string, encoding?: BufferEncoding): Buffer;
/**
* Allocates a new buffer of {size} octets.
*
* @param size count of octets to allocate.
* @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`).
*/
- new (size: number): Buffer;
+ new(size: number): Buffer;
/**
* Allocates a new buffer containing the given {array} of octets.
*
* @param array The octets to store.
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
*/
- new (array: Uint8Array): Buffer;
+ new(array: Uint8Array): Buffer;
/**
* Produces a Buffer backed by the same allocated memory as
* the given {ArrayBuffer}/{SharedArrayBuffer}.
*
- *
* @param arrayBuffer The ArrayBuffer with which to share memory.
* @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead.
*/
- new (arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
+ new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer;
/**
* Allocates a new buffer containing the given {array} of octets.
*
* @param array The octets to store.
* @deprecated since v10.0.0 - Use `Buffer.from(array)` instead.
*/
- new (array: ReadonlyArray): Buffer;
+ new(array: readonly any[]): Buffer;
/**
* Copies the passed {buffer} data onto a new {Buffer} instance.
*
* @param buffer The buffer to copy.
* @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead.
*/
- new (buffer: Buffer): Buffer;
+ new(buffer: Buffer): Buffer;
/**
* Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`.
* Array entries outside that range will be truncated to fit into it.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'.
* const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
* ```
*
+ * If `array` is an `Array`\-like object (that is, one with a `length` property of
+ * type `number`), it is treated as if it is an array, unless it is a `Buffer` or
+ * a `Uint8Array`. This means all other `TypedArray` variants get treated as an `Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`.
+ *
* A `TypeError` will be thrown if `array` is not an `Array` or another type
* appropriate for `Buffer.from()` variants.
*
- * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does.
+ * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does.
* @since v5.10.0
*/
- from(arrayBuffer: WithImplicitCoercion, byteOffset?: number, length?: number): Buffer;
+ from(
+ arrayBuffer: WithImplicitCoercion,
+ byteOffset?: number,
+ length?: number,
+ ): Buffer;
/**
* Creates a new Buffer using the passed {data}
* @param data data to create a new Buffer
*/
- from(data: Uint8Array | ReadonlyArray): Buffer;
- from(data: WithImplicitCoercion | string>): Buffer;
+ from(data: Uint8Array | readonly number[]): Buffer;
+ from(data: WithImplicitCoercion): Buffer;
/**
* Creates a new Buffer containing the given JavaScript string {str}.
* If provided, the {encoding} parameter identifies the character encoding.
@@ -258,9 +353,9 @@ declare module 'buffer' {
str:
| WithImplicitCoercion
| {
- [Symbol.toPrimitive](hint: 'string'): string;
- },
- encoding?: BufferEncoding
+ [Symbol.toPrimitive](hint: "string"): string;
+ },
+ encoding?: BufferEncoding,
): Buffer;
/**
* Creates a new Buffer using the passed {data}
@@ -271,7 +366,7 @@ declare module 'buffer' {
* Returns `true` if `obj` is a `Buffer`, `false` otherwise.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* Buffer.isBuffer(Buffer.alloc(10)); // true
* Buffer.isBuffer(Buffer.from('foo')); // true
@@ -287,7 +382,7 @@ declare module 'buffer' {
* or `false` otherwise.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* console.log(Buffer.isEncoding('utf8'));
* // Prints: true
@@ -316,7 +411,7 @@ declare module 'buffer' {
* string.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const str = '\u00bd + \u00bc = \u00be';
*
@@ -334,11 +429,14 @@ declare module 'buffer' {
* @param [encoding='utf8'] If `string` is a string, this is its encoding.
* @return The number of bytes contained within `string`.
*/
- byteLength(string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, encoding?: BufferEncoding): number;
+ byteLength(
+ string: string | Buffer | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer,
+ encoding?: BufferEncoding,
+ ): number;
/**
- * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together.
+ * Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together.
*
- * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned.
+ * If the list has no items, or if the `totalLength` is 0, then a new zero-length `Buffer` is returned.
*
* If `totalLength` is not provided, it is calculated from the `Buffer` instances
* in `list` by adding their lengths.
@@ -348,7 +446,7 @@ declare module 'buffer' {
* truncated to `totalLength`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Create a single `Buffer` from a list of three `Buffer` instances.
*
@@ -373,12 +471,29 @@ declare module 'buffer' {
* @param list List of `Buffer` or {@link Uint8Array} instances to concatenate.
* @param totalLength Total length of the `Buffer` instances in `list` when concatenated.
*/
- concat(list: ReadonlyArray, totalLength?: number): Buffer;
+ concat(list: readonly Uint8Array[], totalLength?: number): Buffer;
/**
- * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
+ * Copies the underlying memory of `view` into a new `Buffer`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * const u16 = new Uint16Array([0, 0xffff]);
+ * const buf = Buffer.copyBytesFrom(u16, 1, 1);
+ * u16[1] = 0;
+ * console.log(buf.length); // 2
+ * console.log(buf[0]); // 255
+ * console.log(buf[1]); // 255
+ * ```
+ * @since v19.8.0
+ * @param view The {TypedArray} to copy.
+ * @param [offset=0] The starting offset within `view`.
+ * @param [length=view.length - offset] The number of elements from `view` to copy.
+ */
+ copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer;
+ /**
+ * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`.
+ *
+ * ```js
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from('1234');
* const buf2 = Buffer.from('0123');
@@ -391,12 +506,12 @@ declare module 'buffer' {
* @since v0.11.13
* @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details.
*/
- compare(buf1: Uint8Array, buf2: Uint8Array): number;
+ compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1;
/**
* Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.alloc(5);
*
@@ -404,12 +519,12 @@ declare module 'buffer' {
* // Prints:
* ```
*
- * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
+ * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
*
* If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.alloc(5, 'a');
*
@@ -421,7 +536,7 @@ declare module 'buffer' {
* initialized by calling `buf.fill(fill, encoding)`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64');
*
@@ -439,15 +554,15 @@ declare module 'buffer' {
* @param [fill=0] A value to pre-fill the new `Buffer` with.
* @param [encoding='utf8'] If `fill` is a string, this is its encoding.
*/
- alloc(size: number, fill?: string | Buffer | number, encoding?: BufferEncoding): Buffer;
+ alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer;
/**
- * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown.
+ * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown.
*
* The underlying memory for `Buffer` instances created in this way is _not_
- * _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
+ * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(10);
*
@@ -463,9 +578,8 @@ declare module 'buffer' {
* A `TypeError` will be thrown if `size` is not a number.
*
* The `Buffer` module pre-allocates an internal `Buffer` instance of
- * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`,`Buffer.from(array)`, `Buffer.concat()`, and the
- * deprecated`new Buffer(size)` constructor only when `size` is less than or equal
- * to `Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two).
+ * size `Buffer.poolSize` that is used as a pool for the fast allocation of new `Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`,
+ * and `Buffer.concat()` only when `size` is less than `Buffer.poolSize >>> 1` (floor of `Buffer.poolSize` divided by two).
*
* Use of this pre-allocated internal memory pool is a key difference between
* calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`.
@@ -478,15 +592,15 @@ declare module 'buffer' {
*/
allocUnsafe(size: number): Buffer;
/**
- * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_INVALID_ARG_VALUE` is thrown. A zero-length `Buffer` is created
- * if `size` is 0.
+ * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if
+ * `size` is 0.
*
* The underlying memory for `Buffer` instances created in this way is _not_
- * _initialized_. The contents of the newly created `Buffer` are unknown and_may contain sensitive data_. Use `buf.fill(0)` to initialize
+ * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize
* such `Buffer` instances with zeroes.
*
* When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances,
- * allocations under 4 KB are sliced from a single pre-allocated `Buffer`. This
+ * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This
* allows applications to avoid the garbage collection overhead of creating many
* individually allocated `Buffer` instances. This approach improves both
* performance and memory usage by eliminating the need to track and clean up as
@@ -498,7 +612,7 @@ declare module 'buffer' {
* then copying out the relevant bits.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Need to keep around a few small chunks of memory.
* const store = [];
@@ -536,7 +650,7 @@ declare module 'buffer' {
* written. However, partially encoded characters will not be written.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.alloc(256);
*
@@ -572,7 +686,7 @@ declare module 'buffer' {
* as {@link constants.MAX_STRING_LENGTH}.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.allocUnsafe(26);
*
@@ -609,7 +723,7 @@ declare module 'buffer' {
* In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]);
* const json = JSON.stringify(buf);
@@ -629,14 +743,14 @@ declare module 'buffer' {
* @since v0.9.2
*/
toJSON(): {
- type: 'Buffer';
+ type: "Buffer";
data: number[];
};
/**
* Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from('ABC');
* const buf2 = Buffer.from('414243', 'hex');
@@ -660,7 +774,7 @@ declare module 'buffer' {
* * `-1` is returned if `target` should come _after_`buf` when sorted.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from('ABC');
* const buf2 = Buffer.from('BCD');
@@ -681,10 +795,10 @@ declare module 'buffer' {
* // (This result is equal to: [buf1, buf3, buf2].)
* ```
*
- * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively.
+ * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd` arguments can be used to limit the comparison to specific ranges within `target` and `buf` respectively.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]);
* const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]);
@@ -697,7 +811,7 @@ declare module 'buffer' {
* // Prints: 1
* ```
*
- * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
+ * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`, `targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`.
* @since v0.11.13
* @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`.
* @param [targetStart=0] The offset within `target` at which to begin comparison.
@@ -705,7 +819,13 @@ declare module 'buffer' {
* @param [sourceStart=0] The offset within `buf` at which to begin comparison.
* @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive).
*/
- compare(target: Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number;
+ compare(
+ target: Uint8Array,
+ targetStart?: number,
+ targetEnd?: number,
+ sourceStart?: number,
+ sourceEnd?: number,
+ ): -1 | 0 | 1;
/**
* Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`.
*
@@ -714,7 +834,7 @@ declare module 'buffer' {
* different function arguments.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Create two `Buffer` instances.
* const buf1 = Buffer.allocUnsafe(26);
@@ -735,7 +855,7 @@ declare module 'buffer' {
* ```
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Create a `Buffer` and copy data from one region to an overlapping region
* // within the same `Buffer`.
@@ -764,13 +884,11 @@ declare module 'buffer' {
* Returns a new `Buffer` that references the same memory as the original, but
* offset and cropped by the `start` and `end` indices.
*
- * This is the same behavior as `buf.subarray()`.
- *
* This method is not compatible with the `Uint8Array.prototype.slice()`,
* which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('buffer');
*
@@ -781,8 +899,17 @@ declare module 'buffer' {
*
* console.log(buf.toString());
* // Prints: buffer
+ *
+ * // With buf.slice(), the original buffer is modified.
+ * const notReallyCopiedBuf = buf.slice();
+ * notReallyCopiedBuf[0]++;
+ * console.log(notReallyCopiedBuf.toString());
+ * // Prints: cuffer
+ * console.log(buf.toString());
+ * // Also prints: cuffer (!)
* ```
* @since v0.3.0
+ * @deprecated Use `subarray` instead.
* @param [start=0] Where the new `Buffer` will start.
* @param [end=buf.length] Where the new `Buffer` will end (not inclusive).
*/
@@ -799,7 +926,7 @@ declare module 'buffer' {
* Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte
* // from the original `Buffer`.
@@ -826,7 +953,7 @@ declare module 'buffer' {
* end of `buf` rather than the beginning.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('buffer');
*
@@ -853,7 +980,7 @@ declare module 'buffer' {
* `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -874,7 +1001,7 @@ declare module 'buffer' {
* `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -895,7 +1022,7 @@ declare module 'buffer' {
* This function is also available under the `writeBigUint64BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -919,7 +1046,7 @@ declare module 'buffer' {
* Writes `value` to `buf` at the specified `offset` as little-endian
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -948,7 +1075,7 @@ declare module 'buffer' {
* This function is also available under the `writeUintLE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(6);
*
@@ -976,7 +1103,7 @@ declare module 'buffer' {
* This function is also available under the `writeUintBE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(6);
*
@@ -1002,7 +1129,7 @@ declare module 'buffer' {
* when `value` is anything other than a signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(6);
*
@@ -1023,7 +1150,7 @@ declare module 'buffer' {
* signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(6);
*
@@ -1045,7 +1172,7 @@ declare module 'buffer' {
* This function is also available under the `readBigUint64BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
*
@@ -1067,7 +1194,7 @@ declare module 'buffer' {
* This function is also available under the `readBigUint64LE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]);
*
@@ -1102,13 +1229,13 @@ declare module 'buffer' {
*/
readBigInt64LE(offset?: number): bigint;
/**
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned, little-endian integer supporting
* up to 48 bits of accuracy.
*
* This function is also available under the `readUintLE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
*
@@ -1126,13 +1253,13 @@ declare module 'buffer' {
*/
readUintLE(offset: number, byteLength: number): number;
/**
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned big-endian integer supporting
* up to 48 bits of accuracy.
*
* This function is also available under the `readUintBE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
*
@@ -1152,11 +1279,11 @@ declare module 'buffer' {
*/
readUintBE(offset: number, byteLength: number): number;
/**
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a little-endian, two's complement signed value
* supporting up to 48 bits of accuracy.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
*
@@ -1169,11 +1296,11 @@ declare module 'buffer' {
*/
readIntLE(offset: number, byteLength: number): number;
/**
- * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value
+ * Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a big-endian, two's complement signed value
* supporting up to 48 bits of accuracy.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]);
*
@@ -1195,7 +1322,7 @@ declare module 'buffer' {
* This function is also available under the `readUint8` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([1, -2]);
*
@@ -1216,12 +1343,12 @@ declare module 'buffer' {
*/
readUint8(offset?: number): number;
/**
- * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`.
+ * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified `offset`.
*
* This function is also available under the `readUint16LE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56]);
*
@@ -1247,7 +1374,7 @@ declare module 'buffer' {
* This function is also available under the `readUint16BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56]);
*
@@ -1271,7 +1398,7 @@ declare module 'buffer' {
* This function is also available under the `readUint32LE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
*
@@ -1295,7 +1422,7 @@ declare module 'buffer' {
* This function is also available under the `readUint32BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]);
*
@@ -1317,7 +1444,7 @@ declare module 'buffer' {
* Integers read from a `Buffer` are interpreted as two's complement signed values.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([-1, 5]);
*
@@ -1338,7 +1465,7 @@ declare module 'buffer' {
* Integers read from a `Buffer` are interpreted as two's complement signed values.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0, 5]);
*
@@ -1357,7 +1484,7 @@ declare module 'buffer' {
* Integers read from a `Buffer` are interpreted as two's complement signed values.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0, 5]);
*
@@ -1374,7 +1501,7 @@ declare module 'buffer' {
* Integers read from a `Buffer` are interpreted as two's complement signed values.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0, 0, 0, 5]);
*
@@ -1393,7 +1520,7 @@ declare module 'buffer' {
* Integers read from a `Buffer` are interpreted as two's complement signed values.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([0, 0, 0, 5]);
*
@@ -1408,7 +1535,7 @@ declare module 'buffer' {
* Reads a 32-bit, little-endian float from `buf` at the specified `offset`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([1, 2, 3, 4]);
*
@@ -1425,7 +1552,7 @@ declare module 'buffer' {
* Reads a 32-bit, big-endian float from `buf` at the specified `offset`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([1, 2, 3, 4]);
*
@@ -1440,7 +1567,7 @@ declare module 'buffer' {
* Reads a 64-bit, little-endian double from `buf` at the specified `offset`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
*
@@ -1457,7 +1584,7 @@ declare module 'buffer' {
* Reads a 64-bit, big-endian double from `buf` at the specified `offset`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]);
*
@@ -1474,7 +1601,7 @@ declare module 'buffer' {
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
*
@@ -1496,7 +1623,7 @@ declare module 'buffer' {
* between UTF-16 little-endian and UTF-16 big-endian:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('This is little-endian UTF-16', 'utf16le');
* buf.swap16(); // Convert to big-endian UTF-16 text.
@@ -1510,7 +1637,7 @@ declare module 'buffer' {
* byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
*
@@ -1536,7 +1663,7 @@ declare module 'buffer' {
* Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]);
*
@@ -1565,7 +1692,7 @@ declare module 'buffer' {
* This function is also available under the `writeUint8` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1589,13 +1716,13 @@ declare module 'buffer' {
*/
writeUint8(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is
* anything other than an unsigned 16-bit integer.
*
* This function is also available under the `writeUint16LE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1617,13 +1744,13 @@ declare module 'buffer' {
*/
writeUint16LE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an
* unsigned 16-bit integer.
*
* This function is also available under the `writeUint16BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1645,13 +1772,13 @@ declare module 'buffer' {
*/
writeUint16BE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is
* anything other than an unsigned 32-bit integer.
*
* This function is also available under the `writeUint32LE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1672,13 +1799,13 @@ declare module 'buffer' {
*/
writeUint32LE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an
* unsigned 32-bit integer.
*
* This function is also available under the `writeUint32BE` alias.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1706,7 +1833,7 @@ declare module 'buffer' {
* `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(2);
*
@@ -1723,13 +1850,13 @@ declare module 'buffer' {
*/
writeInt8(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
* anything other than a signed 16-bit integer.
*
* The `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(2);
*
@@ -1745,13 +1872,13 @@ declare module 'buffer' {
*/
writeInt16LE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 16-bit integer. Behavior is undefined when `value` is
* anything other than a signed 16-bit integer.
*
* The `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(2);
*
@@ -1767,13 +1894,13 @@ declare module 'buffer' {
*/
writeInt16BE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
* anything other than a signed 32-bit integer.
*
* The `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1789,13 +1916,13 @@ declare module 'buffer' {
*/
writeInt32LE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a valid signed 32-bit integer. Behavior is undefined when `value` is
* anything other than a signed 32-bit integer.
*
* The `value` is interpreted and written as a two's complement signed integer.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1815,7 +1942,7 @@ declare module 'buffer' {
* undefined when `value` is anything other than a JavaScript number.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1835,7 +1962,7 @@ declare module 'buffer' {
* undefined when `value` is anything other than a JavaScript number.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(4);
*
@@ -1851,11 +1978,11 @@ declare module 'buffer' {
*/
writeFloatBE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
+ * Writes `value` to `buf` at the specified `offset` as little-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
* other than a JavaScript number.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -1871,11 +1998,11 @@ declare module 'buffer' {
*/
writeDoubleLE(value: number, offset?: number): number;
/**
- * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything
+ * Writes `value` to `buf` at the specified `offset` as big-endian. The `value` must be a JavaScript number. Behavior is undefined when `value` is anything
* other than a JavaScript number.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(8);
*
@@ -1895,7 +2022,7 @@ declare module 'buffer' {
* the entire `buf` will be filled:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Fill a `Buffer` with the ASCII character 'h'.
*
@@ -1903,6 +2030,12 @@ declare module 'buffer' {
*
* console.log(b.toString());
* // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
+ *
+ * // Fill a buffer with empty string
+ * const c = Buffer.allocUnsafe(5).fill('');
+ *
+ * console.log(c.fill(''));
+ * // Prints:
* ```
*
* `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or
@@ -1913,7 +2046,7 @@ declare module 'buffer' {
* then only the bytes of that character that fit into `buf` are written:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* // Fill a `Buffer` with character that takes up two bytes in UTF-8.
*
@@ -1925,7 +2058,7 @@ declare module 'buffer' {
* fill data remains, an exception is thrown:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.allocUnsafe(5);
*
@@ -1937,7 +2070,7 @@ declare module 'buffer' {
* // Throws an exception.
* ```
* @since v0.5.0
- * @param value The value with which to fill `buf`.
+ * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`.
* @param [offset=0] Number of bytes to skip before starting to fill `buf`.
* @param [end=buf.length] Where to stop filling `buf` (not inclusive).
* @param [encoding='utf8'] The encoding for `value` if `value` is a string.
@@ -1947,14 +2080,14 @@ declare module 'buffer' {
/**
* If `value` is:
*
- * * a string, `value` is interpreted according to the character encoding in`encoding`.
+ * * a string, `value` is interpreted according to the character encoding in `encoding`.
* * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety.
- * To compare a partial `Buffer`, use `buf.slice()`.
+ * To compare a partial `Buffer`, use `buf.subarray`.
* * a number, `value` will be interpreted as an unsigned 8-bit integer
* value between `0` and `255`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('this is a buffer');
*
@@ -1979,7 +2112,7 @@ declare module 'buffer' {
* // Prints: 6
* ```
*
- * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
+ * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
* an integer between 0 and 255.
*
* If `byteOffset` is not a number, it will be coerced to a number. If the result
@@ -1987,7 +2120,7 @@ declare module 'buffer' {
* behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf).
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const b = Buffer.from('abcdef');
*
@@ -2018,7 +2151,7 @@ declare module 'buffer' {
* rather than the first occurrence.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('this buffer is a buffer');
*
@@ -2045,7 +2178,7 @@ declare module 'buffer' {
* // Prints: 4
* ```
*
- * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value,
+ * If `value` is not a string, number, or `Buffer`, this method will throw a `TypeError`. If `value` is a number, it will be coerced to a valid byte value,
* an integer between 0 and 255.
*
* If `byteOffset` is not a number, it will be coerced to a number. Any arguments
@@ -2053,7 +2186,7 @@ declare module 'buffer' {
* This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf).
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const b = Buffer.from('abcdef');
*
@@ -2081,36 +2214,11 @@ declare module 'buffer' {
* @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`.
*/
lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;
- /**
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents
- * of `buf`.
- *
- * ```js
- * import { Buffer } from 'buffer';
- *
- * // Log the entire contents of a `Buffer`.
- *
- * const buf = Buffer.from('buffer');
- *
- * for (const pair of buf.entries()) {
- * console.log(pair);
- * }
- * // Prints:
- * // [0, 98]
- * // [1, 117]
- * // [2, 102]
- * // [3, 102]
- * // [4, 101]
- * // [5, 114]
- * ```
- * @since v1.1.0
- */
- entries(): IterableIterator<[number, number]>;
/**
* Equivalent to `buf.indexOf() !== -1`.
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
*
* const buf = Buffer.from('this is a buffer');
*
@@ -2136,62 +2244,6 @@ declare module 'buffer' {
* @return `true` if `value` was found in `buf`, `false` otherwise.
*/
includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean;
- /**
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices).
- *
- * ```js
- * import { Buffer } from 'buffer';
- *
- * const buf = Buffer.from('buffer');
- *
- * for (const key of buf.keys()) {
- * console.log(key);
- * }
- * // Prints:
- * // 0
- * // 1
- * // 2
- * // 3
- * // 4
- * // 5
- * ```
- * @since v1.1.0
- */
- keys(): IterableIterator;
- /**
- * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is
- * called automatically when a `Buffer` is used in a `for..of` statement.
- *
- * ```js
- * import { Buffer } from 'buffer';
- *
- * const buf = Buffer.from('buffer');
- *
- * for (const value of buf.values()) {
- * console.log(value);
- * }
- * // Prints:
- * // 98
- * // 117
- * // 102
- * // 102
- * // 101
- * // 114
- *
- * for (const value of buf) {
- * console.log(value);
- * }
- * // Prints:
- * // 98
- * // 117
- * // 102
- * // 102
- * // 101
- * // 114
- * ```
- * @since v1.1.0
- */
- values(): IterableIterator;
}
var Buffer: BufferConstructor;
/**
@@ -2204,9 +2256,9 @@ declare module 'buffer' {
* **and should never be used in new code, because they use strings to represent**
* **binary data and predate the introduction of typed arrays in JavaScript.**
* **For code running using Node.js APIs, converting between base64-encoded strings**
- * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
- * @since v15.13.0
- * @deprecated Use `Buffer.from(data, 'base64')` instead.
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
+ * @since v15.13.0, v14.17.0
+ * @legacy Use `Buffer.from(data, 'base64')` instead.
* @param data The Base64-encoded input string.
*/
function atob(data: string): string;
@@ -2220,14 +2272,30 @@ declare module 'buffer' {
* **and should never be used in new code, because they use strings to represent**
* **binary data and predate the introduction of typed arrays in JavaScript.**
* **For code running using Node.js APIs, converting between base64-encoded strings**
- * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.**
- * @since v15.13.0
- * @deprecated Use `buf.toString('base64')` instead.
+ * **and binary data should be performed using `Buffer.from(str, 'base64')` and `buf.toString('base64')`.**
+ * @since v15.13.0, v14.17.0
+ * @legacy Use `buf.toString('base64')` instead.
* @param data An ASCII (Latin1) string.
*/
function btoa(data: string): string;
+ interface Blob extends _Blob {}
+ /**
+ * `Blob` class is a global reference for `require('node:buffer').Blob`
+ * https://nodejs.org/api/buffer.html#class-blob
+ * @since v18.0.0
+ */
+ var Blob: typeof globalThis extends { onmessage: any; Blob: infer T } ? T
+ : typeof import("buffer").Blob;
+ interface File extends _File {}
+ /**
+ * `File` class is a global reference for `require('node:buffer').File`
+ * https://nodejs.org/api/buffer.html#class-file
+ * @since v20.0.0
+ */
+ var File: typeof globalThis extends { onmessage: any; File: infer T } ? T
+ : typeof import("buffer").File;
}
}
-declare module 'node:buffer' {
- export * from 'buffer';
+declare module "node:buffer" {
+ export * from "buffer";
}
diff --git a/node_modules/@types/node/ts4.8/child_process.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/child_process.d.ts
old mode 100755
new mode 100644
similarity index 70%
rename from node_modules/@types/node/ts4.8/child_process.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/child_process.d.ts
index d383145..b642adc
--- a/node_modules/@types/node/ts4.8/child_process.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/child_process.d.ts
@@ -1,10 +1,10 @@
/**
- * The `child_process` module provides the ability to spawn subprocesses in
+ * The `node:child_process` module provides the ability to spawn subprocesses in
* a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability
* is primarily provided by the {@link spawn} function:
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -25,24 +25,27 @@
* limited (and platform-specific) capacity. If the subprocess writes to
* stdout in excess of that limit without the output being captured, the
* subprocess blocks waiting for the pipe buffer to accept more data. This is
- * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed.
+ * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }` option if the output will not be consumed.
*
* The command lookup is performed using the `options.env.PATH` environment
- * variable if it is in the `options` object. Otherwise, `process.env.PATH` is
- * used.
+ * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is
+ * used. If `options.env` is set without `PATH`, lookup on Unix is performed
+ * on a default search path search of `/usr/bin:/bin` (see your operating system's
+ * manual for execvpe/execvp), on Windows the current processes environment
+ * variable `PATH` is used.
*
* On Windows, environment variables are case-insensitive. Node.js
* lexicographically sorts the `env` keys and uses the first one that
* case-insensitively matches. Only first (in lexicographic order) entry will be
* passed to the subprocess. This might lead to issues on Windows when passing
- * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`.
+ * objects to the `env` option that have multiple variants of the same key, such as `PATH` and `Path`.
*
* The {@link spawn} method spawns the child process asynchronously,
* without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks
* the event loop until the spawned process either exits or is terminated.
*
- * For convenience, the `child_process` module provides a handful of synchronous
- * and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
+ * For convenience, the `node:child_process` module provides a handful of
+ * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on
* top of {@link spawn} or {@link spawnSync}.
*
* * {@link exec}: spawns a shell and runs a command within that
@@ -60,16 +63,17 @@
* For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however,
* the synchronous methods can have significant impact on performance due to
* stalling the event loop while spawned processes complete.
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/child_process.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/child_process.js)
*/
-declare module 'child_process' {
- import { ObjectEncodingOptions } from 'node:fs';
- import { EventEmitter, Abortable } from 'node:events';
- import * as net from 'node:net';
- import { Writable, Readable, Stream, Pipe } from 'node:stream';
- import { URL } from 'node:url';
+declare module "child_process" {
+ import { ObjectEncodingOptions } from "node:fs";
+ import { Abortable, EventEmitter } from "node:events";
+ import * as dgram from "node:dgram";
+ import * as net from "node:net";
+ import { Pipe, Readable, Stream, Writable } from "node:stream";
+ import { URL } from "node:url";
type Serializable = string | object | number | boolean | bigint;
- type SendHandle = net.Socket | net.Server;
+ type SendHandle = net.Socket | net.Server | dgram.Socket | undefined;
/**
* Instances of the `ChildProcess` represent spawned child processes.
*
@@ -91,8 +95,7 @@ declare module 'child_process' {
* `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will
* refer to the same value.
*
- * The `subprocess.stdin` property can be `undefined` if the child process could
- * not be successfully spawned.
+ * The `subprocess.stdin` property can be `null` or `undefined` if the child process could not be successfully spawned.
* @since v0.1.90
*/
stdin: Writable | null;
@@ -106,7 +109,7 @@ declare module 'child_process' {
* refer to the same value.
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
*
* const subprocess = spawn('ls');
*
@@ -115,8 +118,7 @@ declare module 'child_process' {
* });
* ```
*
- * The `subprocess.stdout` property can be `null` if the child process could
- * not be successfully spawned.
+ * The `subprocess.stdout` property can be `null` or `undefined` if the child process could not be successfully spawned.
* @since v0.1.90
*/
stdout: Readable | null;
@@ -129,21 +131,20 @@ declare module 'child_process' {
* `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will
* refer to the same value.
*
- * The `subprocess.stderr` property can be `null` if the child process could
- * not be successfully spawned.
+ * The `subprocess.stderr` property can be `null` or `undefined` if the child process could not be successfully spawned.
* @since v0.1.90
*/
stderr: Readable | null;
/**
* The `subprocess.channel` property is a reference to the child's IPC channel. If
- * no IPC channel currently exists, this property is `undefined`.
+ * no IPC channel exists, this property is `undefined`.
* @since v7.1.0
*/
readonly channel?: Pipe | null | undefined;
/**
* A sparse array of pipes to the child process, corresponding with positions in
* the `stdio` option passed to {@link spawn} that have been set
- * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`,
+ * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and `subprocess.stdio[2]` are also available as `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr`,
* respectively.
*
* In the following example, only the child's fd `1` (stdout) is configured as a
@@ -151,16 +152,16 @@ declare module 'child_process' {
* in the array are `null`.
*
* ```js
- * const assert = require('assert');
- * const fs = require('fs');
- * const child_process = require('child_process');
+ * const assert = require('node:assert');
+ * const fs = require('node:fs');
+ * const child_process = require('node:child_process');
*
* const subprocess = child_process.spawn('ls', {
* stdio: [
* 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);
@@ -186,7 +187,7 @@ declare module 'child_process' {
// stderr
Readable | Writable | null | undefined,
// extra
- Readable | Writable | null | undefined // extra
+ Readable | Writable | null | undefined, // extra
];
/**
* The `subprocess.killed` property indicates whether the child process
@@ -201,7 +202,7 @@ declare module 'child_process' {
* emitted.
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const grep = spawn('grep', ['ssh']);
*
* console.log(`Spawned child pid: ${grep.pid}`);
@@ -212,7 +213,7 @@ declare module 'child_process' {
readonly pid?: number | undefined;
/**
* The `subprocess.connected` property indicates whether it is still possible to
- * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages.
+ * send and receive messages from a child process. When `subprocess.connected` is `false`, it is no longer possible to send or receive messages.
* @since v0.7.2
*/
readonly connected: boolean;
@@ -248,7 +249,7 @@ declare module 'child_process' {
* returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise.
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const grep = spawn('grep', ['ssh']);
*
* grep.on('close', (code, signal) => {
@@ -272,7 +273,7 @@ declare module 'child_process' {
* See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference.
*
* On Windows, where POSIX signals do not exist, the `signal` argument will be
- * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`).
+ * ignored, and the process will be killed forcefully and abruptly (similar to `'SIGKILL'`).
* See `Signal Events` for more details.
*
* On Linux, child processes of child processes will not be terminated
@@ -281,7 +282,7 @@ declare module 'child_process' {
*
* ```js
* 'use strict';
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
*
* const subprocess = spawn(
* 'sh',
@@ -291,8 +292,8 @@ declare module 'child_process' {
* console.log(process.pid, 'is alive')
* }, 500);"`,
* ], {
- * stdio: ['inherit', 'inherit', 'inherit']
- * }
+ * stdio: ['inherit', 'inherit', 'inherit'],
+ * },
* );
*
* setTimeout(() => {
@@ -302,6 +303,11 @@ declare module 'child_process' {
* @since v0.1.90
*/
kill(signal?: NodeJS.Signals | number): boolean;
+ /**
+ * Calls {@link ChildProcess.kill} with `'SIGTERM'`.
+ * @since v20.5.0
+ */
+ [Symbol.dispose](): void;
/**
* When an IPC channel has been established between the parent and child (
* i.e. when using {@link fork}), the `subprocess.send()` method can
@@ -314,7 +320,7 @@ declare module 'child_process' {
* For example, in the parent script:
*
* ```js
- * const cp = require('child_process');
+ * const cp = require('node:child_process');
* const n = cp.fork(`${__dirname}/sub.js`);
*
* n.on('message', (m) => {
@@ -341,20 +347,20 @@ declare module 'child_process' {
*
* There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages
* containing a `NODE_` prefix in the `cmd` property are reserved for use within
- * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js.
- * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice.
+ * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the `'internalMessage'` event and are consumed internally by Node.js.
+ * Applications should avoid using such messages or listening for `'internalMessage'` events as it is subject to change without notice.
*
* The optional `sendHandle` argument that may be passed to `subprocess.send()` is
* for passing a TCP server or socket object to the child process. The child will
* receive the object as the second argument passed to the callback function
- * registered on the `'message'` event. Any data that is received
- * and buffered in the socket will not be sent to the child.
+ * registered on the `'message'` event. Any data that is received and buffered in
+ * the socket will not be sent to the child. Sending IPC sockets is not supported on Windows.
*
* The optional `callback` is a function that is invoked after the message is
* sent but before the child may have received it. The function is called with a
* single argument: `null` on success, or an `Error` object on failure.
*
- * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can
+ * If no `callback` function is provided and the message cannot be sent, an `'error'` event will be emitted by the `ChildProcess` object. This can
* happen, for instance, when the child process has already exited.
*
* `subprocess.send()` will return `false` if the channel has closed or when the
@@ -368,10 +374,10 @@ declare module 'child_process' {
* a TCP server object to the child process as illustrated in the example below:
*
* ```js
- * const subprocess = require('child_process').fork('subprocess.js');
+ * const subprocess = require('node:child_process').fork('subprocess.js');
*
* // Open up the server object and send the handle.
- * const server = require('net').createServer();
+ * const server = require('node:net').createServer();
* server.on('connection', (socket) => {
* socket.end('handled by parent');
* });
@@ -395,10 +401,9 @@ declare module 'child_process' {
* Once the server is now shared between the parent and child, some connections
* can be handled by the parent and some by the child.
*
- * While the example above uses a server created using the `net` module, `dgram`module servers use exactly the same workflow with the exceptions of listening on
- * a `'message'` event instead of `'connection'` and using `server.bind()` instead
- * of `server.listen()`. This is, however, currently only supported on Unix
- * platforms.
+ * While the example above uses a server created using the `node:net` module, `node:dgram` module servers use exactly the same workflow with the exceptions of
+ * listening on a `'message'` event instead of `'connection'` and using `server.bind()` instead of `server.listen()`. This is, however, only
+ * supported on Unix platforms.
*
* #### Example: sending a socket object
*
@@ -407,13 +412,13 @@ declare module 'child_process' {
* handle connections with "normal" or "special" priority:
*
* ```js
- * const { fork } = require('child_process');
+ * const { fork } = require('node:child_process');
* const normal = fork('subprocess.js', ['normal']);
* const special = fork('subprocess.js', ['special']);
*
* // Open up the server and send sockets to child. Use pauseOnConnect to prevent
* // the sockets from being read before they are sent to the child process.
- * const server = require('net').createServer({ pauseOnConnect: true });
+ * const server = require('node:net').createServer({ pauseOnConnect: true });
* server.on('connection', (socket) => {
*
* // If this is special priority...
@@ -450,11 +455,17 @@ declare module 'child_process' {
* as the connection may have been closed during the time it takes to send the
* connection to the child.
* @since v0.5.9
+ * @param sendHandle `undefined`, or a [`net.Socket`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netsocket), [`net.Server`](https://nodejs.org/docs/latest-v20.x/api/net.html#class-netserver), or [`dgram.Socket`](https://nodejs.org/docs/latest-v20.x/api/dgram.html#class-dgramsocket) object.
* @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties:
*/
send(message: Serializable, callback?: (error: Error | null) => void): boolean;
send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean;
- send(message: Serializable, sendHandle?: SendHandle, options?: MessageOptions, callback?: (error: Error | null) => void): boolean;
+ send(
+ message: Serializable,
+ sendHandle?: SendHandle,
+ options?: MessageOptions,
+ callback?: (error: Error | null) => void,
+ ): boolean;
/**
* Closes the IPC channel between parent and child, allowing the child to exit
* gracefully once there are no other connections keeping it alive. After calling
@@ -473,17 +484,17 @@ declare module 'child_process' {
disconnect(): void;
/**
* By default, the parent will wait for the detached child to exit. To prevent the
- * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not
+ * parent from waiting for a given `subprocess` to exit, use the `subprocess.unref()` method. Doing so will cause the parent's event loop to not
* include the child in its reference count, allowing the parent to exit
* independently of the child, unless there is an established IPC channel between
* the child and the parent.
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
*
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
* detached: true,
- * stdio: 'ignore'
+ * stdio: 'ignore',
* });
*
* subprocess.unref();
@@ -497,11 +508,11 @@ declare module 'child_process' {
* to wait for the child to exit before exiting itself.
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
*
* const subprocess = spawn(process.argv[0], ['child_program.js'], {
* detached: true,
- * stdio: 'ignore'
+ * stdio: 'ignore',
* });
*
* subprocess.unref();
@@ -520,47 +531,53 @@ declare module 'child_process' {
* 6. spawn
*/
addListener(event: string, listener: (...args: any[]) => void): this;
- addListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- addListener(event: 'disconnect', listener: () => void): this;
- addListener(event: 'error', listener: (err: Error) => void): this;
- addListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- addListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this;
- addListener(event: 'spawn', listener: () => void): this;
+ addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ addListener(event: "disconnect", listener: () => void): this;
+ addListener(event: "error", listener: (err: Error) => void): this;
+ addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
+ addListener(event: "spawn", listener: () => void): this;
emit(event: string | symbol, ...args: any[]): boolean;
- emit(event: 'close', code: number | null, signal: NodeJS.Signals | null): boolean;
- emit(event: 'disconnect'): boolean;
- emit(event: 'error', err: Error): boolean;
- emit(event: 'exit', code: number | null, signal: NodeJS.Signals | null): boolean;
- emit(event: 'message', message: Serializable, sendHandle: SendHandle): boolean;
- emit(event: 'spawn', listener: () => void): boolean;
+ emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean;
+ emit(event: "disconnect"): boolean;
+ emit(event: "error", err: Error): boolean;
+ emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean;
+ emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean;
+ emit(event: "spawn", listener: () => void): boolean;
on(event: string, listener: (...args: any[]) => void): this;
- on(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- on(event: 'disconnect', listener: () => void): this;
- on(event: 'error', listener: (err: Error) => void): this;
- on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- on(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this;
- on(event: 'spawn', listener: () => void): this;
+ on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ on(event: "disconnect", listener: () => void): this;
+ on(event: "error", listener: (err: Error) => void): this;
+ on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
+ on(event: "spawn", listener: () => void): this;
once(event: string, listener: (...args: any[]) => void): this;
- once(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- once(event: 'disconnect', listener: () => void): this;
- once(event: 'error', listener: (err: Error) => void): this;
- once(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- once(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this;
- once(event: 'spawn', listener: () => void): this;
+ once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ once(event: "disconnect", listener: () => void): this;
+ once(event: "error", listener: (err: Error) => void): this;
+ once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
+ once(event: "spawn", listener: () => void): this;
prependListener(event: string, listener: (...args: any[]) => void): this;
- prependListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- prependListener(event: 'disconnect', listener: () => void): this;
- prependListener(event: 'error', listener: (err: Error) => void): this;
- prependListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- prependListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this;
- prependListener(event: 'spawn', listener: () => void): this;
+ prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ prependListener(event: "disconnect", listener: () => void): this;
+ prependListener(event: "error", listener: (err: Error) => void): this;
+ prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
+ prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
+ prependListener(event: "spawn", listener: () => void): this;
prependOnceListener(event: string, listener: (...args: any[]) => void): this;
- prependOnceListener(event: 'close', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- prependOnceListener(event: 'disconnect', listener: () => void): this;
- prependOnceListener(event: 'error', listener: (err: Error) => void): this;
- prependOnceListener(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this;
- prependOnceListener(event: 'message', listener: (message: Serializable, sendHandle: SendHandle) => void): this;
- prependOnceListener(event: 'spawn', listener: () => void): this;
+ prependOnceListener(
+ event: "close",
+ listener: (code: number | null, signal: NodeJS.Signals | null) => void,
+ ): this;
+ prependOnceListener(event: "disconnect", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (err: Error) => void): this;
+ prependOnceListener(
+ event: "exit",
+ listener: (code: number | null, signal: NodeJS.Signals | null) => void,
+ ): this;
+ prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this;
+ prependOnceListener(event: "spawn", listener: () => void): this;
}
// return this object when stdio option is undefined or not specified
interface ChildProcessWithoutNullStreams extends ChildProcess {
@@ -574,11 +591,13 @@ declare module 'child_process' {
// stderr
Readable | Writable | null | undefined,
// extra, no modification
- Readable | Writable | null | undefined // extra, no modification
+ Readable | Writable | null | undefined, // extra, no modification
];
}
// return this object when stdio option is a tuple of 3
- interface ChildProcessByStdio extends ChildProcess {
+ interface ChildProcessByStdio
+ extends ChildProcess
+ {
stdin: I;
stdout: O;
stderr: E;
@@ -588,15 +607,15 @@ declare module 'child_process' {
E,
Readable | Writable | null | undefined,
// extra, no modification
- Readable | Writable | null | undefined // extra, no modification
+ Readable | Writable | null | undefined, // extra, no modification
];
}
interface MessageOptions {
keepOpen?: boolean | undefined;
}
- type IOType = 'overlapped' | 'pipe' | 'ignore' | 'inherit';
- type StdioOptions = IOType | Array;
- type SerializationType = 'json' | 'advanced';
+ type IOType = "overlapped" | "pipe" | "ignore" | "inherit";
+ type StdioOptions = IOType | Array;
+ type SerializationType = "json" | "advanced";
interface MessagingOptions extends Abortable {
/**
* Specify the kind of serialization used for sending messages between processes.
@@ -621,7 +640,7 @@ declare module 'child_process' {
}
interface CommonOptions extends ProcessEnvOptions {
/**
- * @default true
+ * @default false
*/
windowsHide?: boolean | undefined;
/**
@@ -631,6 +650,15 @@ declare module 'child_process' {
}
interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable {
argv0?: string | undefined;
+ /**
+ * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
+ * If passed as an array, the first element is used for `stdin`, the second for
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
+ * specify the `stdio` behavior beyond the standard streams. See
+ * {@link ChildProcess.stdio} for more information.
+ *
+ * @default 'pipe'
+ */
stdio?: StdioOptions | undefined;
shell?: boolean | string | undefined;
windowsVerbatimArguments?: boolean | undefined;
@@ -641,14 +669,18 @@ declare module 'child_process' {
interface SpawnOptionsWithoutStdio extends SpawnOptions {
stdio?: StdioPipeNamed | StdioPipe[] | undefined;
}
- type StdioNull = 'inherit' | 'ignore' | Stream;
- type StdioPipeNamed = 'pipe' | 'overlapped';
+ type StdioNull = "inherit" | "ignore" | Stream;
+ type StdioPipeNamed = "pipe" | "overlapped";
type StdioPipe = undefined | null | StdioPipeNamed;
- interface SpawnOptionsWithStdioTuple extends SpawnOptions {
+ interface SpawnOptionsWithStdioTuple<
+ Stdin extends StdioNull | StdioPipe,
+ Stdout extends StdioNull | StdioPipe,
+ Stderr extends StdioNull | StdioPipe,
+ > extends SpawnOptions {
stdio: [Stdin, Stdout, Stderr];
}
/**
- * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults
+ * The `child_process.spawn()` method spawns a new process using the given `command`, with command-line arguments in `args`. If omitted, `args` defaults
* to an empty array.
*
* **If the `shell` option is enabled, do not pass unsanitized user input to this**
@@ -660,7 +692,7 @@ declare module 'child_process' {
* ```js
* const defaults = {
* cwd: undefined,
- * env: process.env
+ * env: process.env,
* };
* ```
*
@@ -679,7 +711,7 @@ declare module 'child_process' {
* exit code:
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const ls = spawn('ls', ['-lh', '/usr']);
*
* ls.stdout.on('data', (data) => {
@@ -698,7 +730,7 @@ declare module 'child_process' {
* Example: A very elaborate way to run `ps ax | grep ssh`
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const ps = spawn('ps', ['ax']);
* const grep = spawn('grep', ['ssh']);
*
@@ -735,7 +767,7 @@ declare module 'child_process' {
* Example of checking for failed `spawn`:
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const subprocess = spawn('bad_command');
*
* subprocess.on('error', (err) => {
@@ -746,14 +778,14 @@ declare module 'child_process' {
* Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process
* title while others (Windows, SunOS) will use `command`.
*
- * Node.js currently overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent,
- * retrieve it with the`process.argv0` property instead.
+ * Node.js overwrites `argv[0]` with `process.execPath` on startup, so `process.argv[0]` in a Node.js child process will not match the `argv0` parameter passed to `spawn` from the parent. Retrieve
+ * it with the `process.argv0` property instead.
*
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
* the error passed to the callback will be an `AbortError`:
*
* ```js
- * const { spawn } = require('child_process');
+ * const { spawn } = require('node:child_process');
* const controller = new AbortController();
* const { signal } = controller;
* const grep = spawn('grep', ['ssh'], { signal });
@@ -767,26 +799,86 @@ declare module 'child_process' {
* @param args List of string arguments.
*/
function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
function spawn(command: string, options: SpawnOptions): ChildProcess;
// overloads of spawn with 'args'
- function spawn(command: string, args?: ReadonlyArray, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptionsWithStdioTuple): ChildProcessByStdio;
- function spawn(command: string, args: ReadonlyArray, options: SpawnOptions): ChildProcess;
+ function spawn(
+ command: string,
+ args?: readonly string[],
+ options?: SpawnOptionsWithoutStdio,
+ ): ChildProcessWithoutNullStreams;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(
+ command: string,
+ args: readonly string[],
+ options: SpawnOptionsWithStdioTuple,
+ ): ChildProcessByStdio;
+ function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess;
interface ExecOptions extends CommonOptions {
shell?: string | undefined;
signal?: AbortSignal | undefined;
@@ -804,6 +896,8 @@ declare module 'child_process' {
killed?: boolean | undefined;
code?: number | undefined;
signal?: NodeJS.Signals | undefined;
+ stdout?: string;
+ stderr?: string;
}
/**
* Spawns a shell then executes the `command` within that shell, buffering any
@@ -812,7 +906,7 @@ declare module 'child_process' {
* need to be dealt with accordingly:
*
* ```js
- * const { exec } = require('child_process');
+ * const { exec } = require('node:child_process');
*
* exec('"/path/to/test file/test.sh" arg1 arg2');
* // Double quotes are used so that the space in the path is not interpreted as
@@ -825,9 +919,9 @@ declare module 'child_process' {
* **Never pass unsanitized user input to this function. Any input containing shell**
* **metacharacters may be used to trigger arbitrary command execution.**
*
- * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The
+ * If a `callback` function is provided, it is called with the arguments `(error, stdout, stderr)`. On success, `error` will be `null`. On error, `error` will be an instance of `Error`. The
* `error.code` property will be
- * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the
+ * the exit code of the process. By convention, any exit code other than `0` indicates an error. `error.signal` will be the signal that terminated the
* process.
*
* The `stdout` and `stderr` arguments passed to the callback will contain the
@@ -838,7 +932,7 @@ declare module 'child_process' {
* encoding, `Buffer` objects will be passed to the callback instead.
*
* ```js
- * const { exec } = require('child_process');
+ * const { exec } = require('node:child_process');
* exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => {
* if (error) {
* console.error(`exec error: ${error}`);
@@ -857,14 +951,14 @@ declare module 'child_process' {
* the existing process and uses a shell to execute the command.
*
* If this method is invoked as its `util.promisify()` ed version, it returns
- * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
+ * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
* case of an error (including any error resulting in an exit code other than 0), a
* rejected promise is returned, with the same `error` object given in the
* callback, but with two additional properties `stdout` and `stderr`.
*
* ```js
- * const util = require('util');
- * const exec = util.promisify(require('child_process').exec);
+ * const util = require('node:util');
+ * const exec = util.promisify(require('node:child_process').exec);
*
* async function lsExample() {
* const { stdout, stderr } = await exec('ls');
@@ -874,15 +968,15 @@ declare module 'child_process' {
* lsExample();
* ```
*
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
* the error passed to the callback will be an `AbortError`:
*
* ```js
- * const { exec } = require('child_process');
+ * const { exec } = require('node:child_process');
* const controller = new AbortController();
* const { signal } = controller;
* const child = exec('grep ssh', { signal }, (error) => {
- * console.log(error); // an AbortError
+ * console.error(error); // an AbortError
* });
* controller.abort();
* ```
@@ -890,14 +984,17 @@ declare module 'child_process' {
* @param command The command to run, with space-separated arguments.
* @param callback called with the output when process terminates.
*/
- function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+ function exec(
+ command: string,
+ callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
function exec(
command: string,
options: {
- encoding: 'buffer' | null;
+ encoding: "buffer" | null;
} & ExecOptions,
- callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void
+ callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void,
): ChildProcess;
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
function exec(
@@ -905,7 +1002,7 @@ declare module 'child_process' {
options: {
encoding: BufferEncoding;
} & ExecOptions,
- callback?: (error: ExecException | null, stdout: string, stderr: string) => void
+ callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
): ChildProcess;
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
@@ -914,15 +1011,19 @@ declare module 'child_process' {
options: {
encoding: BufferEncoding;
} & ExecOptions,
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void
+ callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
): ChildProcess;
// `options` without an `encoding` means stdout/stderr are definitely `string`.
- function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
+ function exec(
+ command: string,
+ options: ExecOptions,
+ callback?: (error: ExecException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
// fallback if nothing else matches. Worst case is always `string | Buffer`.
function exec(
command: string,
options: (ObjectEncodingOptions & ExecOptions) | undefined | null,
- callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void
+ callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
): ChildProcess;
interface PromiseWithChild extends Promise {
child: ChildProcess;
@@ -935,8 +1036,8 @@ declare module 'child_process' {
function __promisify__(
command: string,
options: {
- encoding: 'buffer' | null;
- } & ExecOptions
+ encoding: "buffer" | null;
+ } & ExecOptions,
): PromiseWithChild<{
stdout: Buffer;
stderr: Buffer;
@@ -945,21 +1046,21 @@ declare module 'child_process' {
command: string,
options: {
encoding: BufferEncoding;
- } & ExecOptions
+ } & ExecOptions,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
command: string,
- options: ExecOptions
+ options: ExecOptions,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
command: string,
- options?: (ObjectEncodingOptions & ExecOptions) | null
+ options?: (ObjectEncodingOptions & ExecOptions) | null,
): PromiseWithChild<{
stdout: string | Buffer;
stderr: string | Buffer;
@@ -976,12 +1077,15 @@ declare module 'child_process' {
encoding: BufferEncoding;
}
interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions {
- encoding: 'buffer' | null;
+ encoding: "buffer" | null;
}
interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions {
encoding: BufferEncoding;
}
- type ExecFileException = ExecException & NodeJS.ErrnoException;
+ type ExecFileException =
+ & Omit
+ & Omit
+ & { code?: string | number | undefined | null };
/**
* The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified
* executable `file` is spawned directly as a new process making it slightly more
@@ -992,7 +1096,7 @@ declare module 'child_process' {
* supported.
*
* ```js
- * const { execFile } = require('child_process');
+ * const { execFile } = require('node:child_process');
* const child = execFile('node', ['--version'], (error, stdout, stderr) => {
* if (error) {
* throw error;
@@ -1009,14 +1113,14 @@ declare module 'child_process' {
* encoding, `Buffer` objects will be passed to the callback instead.
*
* If this method is invoked as its `util.promisify()` ed version, it returns
- * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In
+ * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned `ChildProcess` instance is attached to the `Promise` as a `child` property. In
* case of an error (including any error resulting in an exit code other than 0), a
* rejected promise is returned, with the same `error` object given in the
* callback, but with two additional properties `stdout` and `stderr`.
*
* ```js
- * const util = require('util');
- * const execFile = util.promisify(require('child_process').execFile);
+ * const util = require('node:util');
+ * const execFile = util.promisify(require('node:child_process').execFile);
* async function getVersion() {
* const { stdout } = await execFile('node', ['--version']);
* console.log(stdout);
@@ -1028,15 +1132,15 @@ declare module 'child_process' {
* **function. Any input containing shell metacharacters may be used to trigger**
* **arbitrary command execution.**
*
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
* the error passed to the callback will be an `AbortError`:
*
* ```js
- * const { execFile } = require('child_process');
+ * const { execFile } = require('node:child_process');
* const controller = new AbortController();
* const { signal } = controller;
* const child = execFile('node', ['--version'], { signal }, (error) => {
- * console.log(error); // an AbortError
+ * console.error(error); // an AbortError
* });
* controller.abort();
* ```
@@ -1046,56 +1150,92 @@ declare module 'child_process' {
* @param callback Called with the output when process terminates.
*/
function execFile(file: string): ChildProcess;
- function execFile(file: string, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
- function execFile(file: string, args?: ReadonlyArray | null): ChildProcess;
- function execFile(file: string, args: ReadonlyArray | undefined | null, options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null): ChildProcess;
- // no `options` definitely means stdout/stderr are `string`.
- function execFile(file: string, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
- function execFile(file: string, args: ReadonlyArray | undefined | null, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
- // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
- function execFile(file: string, options: ExecFileOptionsWithBufferEncoding, callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
function execFile(
file: string,
- args: ReadonlyArray | undefined | null,
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
+ ): ChildProcess;
+ function execFile(file: string, args?: readonly string[] | null): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
+ ): ChildProcess;
+ // no `options` definitely means stdout/stderr are `string`.
+ function execFile(
+ file: string,
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
+ // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
+ function execFile(
+ file: string,
options: ExecFileOptionsWithBufferEncoding,
- callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void
+ callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithBufferEncoding,
+ callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void,
): ChildProcess;
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
- function execFile(file: string, options: ExecFileOptionsWithStringEncoding, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
function execFile(
file: string,
- args: ReadonlyArray | undefined | null,
options: ExecFileOptionsWithStringEncoding,
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithStringEncoding,
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
): ChildProcess;
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
- function execFile(file: string, options: ExecFileOptionsWithOtherEncoding, callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
function execFile(
file: string,
- args: ReadonlyArray | undefined | null,
options: ExecFileOptionsWithOtherEncoding,
- callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void
+ callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithOtherEncoding,
+ callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void,
): ChildProcess;
// `options` without an `encoding` means stdout/stderr are definitely `string`.
- function execFile(file: string, options: ExecFileOptions, callback: (error: ExecFileException | null, stdout: string, stderr: string) => void): ChildProcess;
function execFile(
file: string,
- args: ReadonlyArray | undefined | null,
options: ExecFileOptions,
- callback: (error: ExecFileException | null, stdout: string, stderr: string) => void
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
+ ): ChildProcess;
+ function execFile(
+ file: string,
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptions,
+ callback: (error: ExecFileException | null, stdout: string, stderr: string) => void,
): ChildProcess;
// fallback if nothing else matches. Worst case is always `string | Buffer`.
function execFile(
file: string,
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
- callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null
+ callback:
+ | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
+ | undefined
+ | null,
): ChildProcess;
function execFile(
file: string,
- args: ReadonlyArray | undefined | null,
+ args: readonly string[] | undefined | null,
options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
- callback: ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) | undefined | null
+ callback:
+ | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void)
+ | undefined
+ | null,
): ChildProcess;
namespace execFile {
function __promisify__(file: string): PromiseWithChild<{
@@ -1104,82 +1244,82 @@ declare module 'child_process' {
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null
+ args: readonly string[] | undefined | null,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
file: string,
- options: ExecFileOptionsWithBufferEncoding
+ options: ExecFileOptionsWithBufferEncoding,
): PromiseWithChild<{
stdout: Buffer;
stderr: Buffer;
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null,
- options: ExecFileOptionsWithBufferEncoding
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithBufferEncoding,
): PromiseWithChild<{
stdout: Buffer;
stderr: Buffer;
}>;
function __promisify__(
file: string,
- options: ExecFileOptionsWithStringEncoding
+ options: ExecFileOptionsWithStringEncoding,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null,
- options: ExecFileOptionsWithStringEncoding
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithStringEncoding,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
file: string,
- options: ExecFileOptionsWithOtherEncoding
+ options: ExecFileOptionsWithOtherEncoding,
): PromiseWithChild<{
stdout: string | Buffer;
stderr: string | Buffer;
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null,
- options: ExecFileOptionsWithOtherEncoding
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptionsWithOtherEncoding,
): PromiseWithChild<{
stdout: string | Buffer;
stderr: string | Buffer;
}>;
function __promisify__(
file: string,
- options: ExecFileOptions
+ options: ExecFileOptions,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null,
- options: ExecFileOptions
+ args: readonly string[] | undefined | null,
+ options: ExecFileOptions,
): PromiseWithChild<{
stdout: string;
stderr: string;
}>;
function __promisify__(
file: string,
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
): PromiseWithChild<{
stdout: string | Buffer;
stderr: string | Buffer;
}>;
function __promisify__(
file: string,
- args: ReadonlyArray | undefined | null,
- options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null
+ args: readonly string[] | undefined | null,
+ options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null,
): PromiseWithChild<{
stdout: string | Buffer;
stderr: string | Buffer;
@@ -1189,6 +1329,15 @@ declare module 'child_process' {
execPath?: string | undefined;
execArgv?: string[] | undefined;
silent?: boolean | undefined;
+ /**
+ * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings.
+ * If passed as an array, the first element is used for `stdin`, the second for
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
+ * specify the `stdio` behavior beyond the standard streams. See
+ * {@link ChildProcess.stdio} for more information.
+ *
+ * @default 'pipe'
+ */
stdio?: StdioOptions | undefined;
detached?: boolean | undefined;
windowsVerbatimArguments?: boolean | undefined;
@@ -1207,7 +1356,7 @@ declare module 'child_process' {
* required, spawning a large number of child Node.js processes is not
* recommended.
*
- * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative
+ * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the `options` object allows for an alternative
* execution path to be used.
*
* Node.js processes launched with a custom `execPath` will communicate with the
@@ -1217,9 +1366,9 @@ declare module 'child_process' {
* Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the
* current process.
*
- * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set.
+ * The `shell` option available in {@link spawn} is not supported by `child_process.fork()` and will be ignored if set.
*
- * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except
+ * If the `signal` option is enabled, calling `.abort()` on the corresponding `AbortController` is similar to calling `.kill()` on the child process except
* the error passed to the callback will be an `AbortError`:
*
* ```js
@@ -1228,7 +1377,7 @@ declare module 'child_process' {
* console.log(`Hello from ${process.argv[2]}!`);
* }, 1_000);
* } else {
- * const { fork } = require('child_process');
+ * const { fork } = require('node:child_process');
* const controller = new AbortController();
* const { signal } = controller;
* const child = fork(__filename, ['child'], { signal });
@@ -1242,18 +1391,18 @@ declare module 'child_process' {
* @param modulePath The module to run in the child.
* @param args List of string arguments.
*/
- function fork(modulePath: string, options?: ForkOptions): ChildProcess;
- function fork(modulePath: string, args?: ReadonlyArray, options?: ForkOptions): ChildProcess;
+ function fork(modulePath: string | URL, options?: ForkOptions): ChildProcess;
+ function fork(modulePath: string | URL, args?: readonly string[], options?: ForkOptions): ChildProcess;
interface SpawnSyncOptions extends CommonSpawnOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
maxBuffer?: number | undefined;
- encoding?: BufferEncoding | 'buffer' | null | undefined;
+ encoding?: BufferEncoding | "buffer" | null | undefined;
}
interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions {
encoding: BufferEncoding;
}
interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions {
- encoding?: 'buffer' | null | undefined;
+ encoding?: "buffer" | null | undefined;
}
interface SpawnSyncReturns {
pid: number;
@@ -1283,16 +1432,37 @@ declare module 'child_process' {
function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns;
function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns;
function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns;
- function spawnSync(command: string, args: ReadonlyArray): SpawnSyncReturns;
- function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns;
- function spawnSync(command: string, args: ReadonlyArray, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns;
- function spawnSync(command: string, args?: ReadonlyArray, options?: SpawnSyncOptions): SpawnSyncReturns;
+ function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns;
+ function spawnSync(
+ command: string,
+ args: readonly string[],
+ options: SpawnSyncOptionsWithStringEncoding,
+ ): SpawnSyncReturns;
+ function spawnSync(
+ command: string,
+ args: readonly string[],
+ options: SpawnSyncOptionsWithBufferEncoding,
+ ): SpawnSyncReturns;
+ function spawnSync(
+ command: string,
+ args?: readonly string[],
+ options?: SpawnSyncOptions,
+ ): SpawnSyncReturns;
interface CommonExecOptions extends CommonOptions {
input?: string | NodeJS.ArrayBufferView | undefined;
+ /**
+ * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings.
+ * If passed as an array, the first element is used for `stdin`, the second for
+ * `stdout`, and the third for `stderr`. A fourth element can be used to
+ * specify the `stdio` behavior beyond the standard streams. See
+ * {@link ChildProcess.stdio} for more information.
+ *
+ * @default 'pipe'
+ */
stdio?: StdioOptions | undefined;
killSignal?: NodeJS.Signals | number | undefined;
maxBuffer?: number | undefined;
- encoding?: BufferEncoding | 'buffer' | null | undefined;
+ encoding?: BufferEncoding | "buffer" | null | undefined;
}
interface ExecSyncOptions extends CommonExecOptions {
shell?: string | undefined;
@@ -1301,13 +1471,13 @@ declare module 'child_process' {
encoding: BufferEncoding;
}
interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions {
- encoding?: 'buffer' | null | undefined;
+ encoding?: "buffer" | null | undefined;
}
/**
* The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return
* until the child process has fully closed. When a timeout has been encountered
* and `killSignal` is sent, the method won't return until the process has
- * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process
+ * completely exited. If the child process intercepts and handles the `SIGTERM` signal and doesn't exit, the parent process will wait until the child process
* has exited.
*
* If the process times out or has a non-zero exit code, this method will throw.
@@ -1330,7 +1500,7 @@ declare module 'child_process' {
encoding: BufferEncoding;
}
interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions {
- encoding?: 'buffer' | null; // specify `null`.
+ encoding?: "buffer" | null; // specify `null`.
}
/**
* The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not
@@ -1356,11 +1526,19 @@ declare module 'child_process' {
function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string;
function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer;
- function execFileSync(file: string, args: ReadonlyArray): Buffer;
- function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithStringEncoding): string;
- function execFileSync(file: string, args: ReadonlyArray, options: ExecFileSyncOptionsWithBufferEncoding): Buffer;
- function execFileSync(file: string, args?: ReadonlyArray, options?: ExecFileSyncOptions): string | Buffer;
+ function execFileSync(file: string, args: readonly string[]): Buffer;
+ function execFileSync(
+ file: string,
+ args: readonly string[],
+ options: ExecFileSyncOptionsWithStringEncoding,
+ ): string;
+ function execFileSync(
+ file: string,
+ args: readonly string[],
+ options: ExecFileSyncOptionsWithBufferEncoding,
+ ): Buffer;
+ function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer;
}
-declare module 'node:child_process' {
- export * from 'child_process';
+declare module "node:child_process" {
+ export * from "child_process";
}
diff --git a/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/cluster.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/cluster.d.ts
new file mode 100644
index 0000000..7711927
--- /dev/null
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/cluster.d.ts
@@ -0,0 +1,578 @@
+/**
+ * Clusters of Node.js processes can be used to run multiple instances of Node.js
+ * that can distribute workloads among their application threads. When process isolation
+ * is not needed, use the [`worker_threads`](https://nodejs.org/docs/latest-v20.x/api/worker_threads.html)
+ * module instead, which allows running multiple application threads within a single Node.js instance.
+ *
+ * The cluster module allows easy creation of child processes that all share
+ * server ports.
+ *
+ * ```js
+ * import cluster from 'node:cluster';
+ * import http from 'node:http';
+ * import { availableParallelism } from 'node:os';
+ * import process from 'node:process';
+ *
+ * const numCPUs = availableParallelism();
+ *
+ * if (cluster.isPrimary) {
+ * console.log(`Primary ${process.pid} is running`);
+ *
+ * // Fork workers.
+ * for (let i = 0; i < numCPUs; i++) {
+ * cluster.fork();
+ * }
+ *
+ * cluster.on('exit', (worker, code, signal) => {
+ * console.log(`worker ${worker.process.pid} died`);
+ * });
+ * } else {
+ * // Workers can share any TCP connection
+ * // In this case it is an HTTP server
+ * http.createServer((req, res) => {
+ * res.writeHead(200);
+ * res.end('hello world\n');
+ * }).listen(8000);
+ *
+ * console.log(`Worker ${process.pid} started`);
+ * }
+ * ```
+ *
+ * Running Node.js will now share port 8000 between the workers:
+ *
+ * ```console
+ * $ node server.js
+ * Primary 3596 is running
+ * Worker 4324 started
+ * Worker 4520 started
+ * Worker 6056 started
+ * Worker 5644 started
+ * ```
+ *
+ * On Windows, it is not yet possible to set up a named pipe server in a worker.
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/cluster.js)
+ */
+declare module "cluster" {
+ import * as child from "node:child_process";
+ import EventEmitter = require("node:events");
+ import * as net from "node:net";
+ type SerializationType = "json" | "advanced";
+ export interface ClusterSettings {
+ /**
+ * List of string arguments passed to the Node.js executable.
+ * @default process.execArgv
+ */
+ execArgv?: string[] | undefined;
+ /**
+ * File path to worker file.
+ * @default process.argv[1]
+ */
+ exec?: string | undefined;
+ /**
+ * String arguments passed to worker.
+ * @default process.argv.slice(2)
+ */
+ args?: string[] | undefined;
+ /**
+ * Whether or not to send output to parent's stdio.
+ * @default false
+ */
+ silent?: boolean | undefined;
+ /**
+ * Configures the stdio of forked processes. Because the cluster module relies on IPC to function, this configuration must
+ * contain an `'ipc'` entry. When this option is provided, it overrides `silent`. See [`child_prcess.spawn()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processspawncommand-args-options)'s
+ * [`stdio`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#optionsstdio).
+ */
+ stdio?: any[] | undefined;
+ /**
+ * Sets the user identity of the process. (See [`setuid(2)`](https://man7.org/linux/man-pages/man2/setuid.2.html).)
+ */
+ uid?: number | undefined;
+ /**
+ * Sets the group identity of the process. (See [`setgid(2)`](https://man7.org/linux/man-pages/man2/setgid.2.html).)
+ */
+ gid?: number | undefined;
+ /**
+ * Sets inspector port of worker. This can be a number, or a function that takes no arguments and returns a number.
+ * By default each worker gets its own port, incremented from the primary's `process.debugPort`.
+ */
+ inspectPort?: number | (() => number) | undefined;
+ /**
+ * Specify the kind of serialization used for sending messages between processes. Possible values are `'json'` and `'advanced'`.
+ * See [Advanced serialization for `child_process`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#advanced-serialization) for more details.
+ * @default false
+ */
+ serialization?: SerializationType | undefined;
+ /**
+ * Current working directory of the worker process.
+ * @default undefined (inherits from parent process)
+ */
+ cwd?: string | undefined;
+ /**
+ * Hide the forked processes console window that would normally be created on Windows systems.
+ * @default false
+ */
+ windowsHide?: boolean | undefined;
+ }
+ export interface Address {
+ address: string;
+ port: number;
+ /**
+ * The `addressType` is one of:
+ *
+ * * `4` (TCPv4)
+ * * `6` (TCPv6)
+ * * `-1` (Unix domain socket)
+ * * `'udp4'` or `'udp6'` (UDPv4 or UDPv6)
+ */
+ addressType: 4 | 6 | -1 | "udp4" | "udp6";
+ }
+ /**
+ * A `Worker` object contains all public information and method about a worker.
+ * In the primary it can be obtained using `cluster.workers`. In a worker
+ * it can be obtained using `cluster.worker`.
+ * @since v0.7.0
+ */
+ export class Worker extends EventEmitter {
+ /**
+ * Each new worker is given its own unique id, this id is stored in the `id`.
+ *
+ * While a worker is alive, this is the key that indexes it in `cluster.workers`.
+ * @since v0.8.0
+ */
+ id: number;
+ /**
+ * All workers are created using [`child_process.fork()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options), the returned object
+ * from this function is stored as `.process`. In a worker, the global `process` is stored.
+ *
+ * See: [Child Process module](https://nodejs.org/docs/latest-v20.x/api/child_process.html#child_processforkmodulepath-args-options).
+ *
+ * Workers will call `process.exit(0)` if the `'disconnect'` event occurs
+ * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against
+ * accidental disconnection.
+ * @since v0.7.0
+ */
+ process: child.ChildProcess;
+ /**
+ * Send a message to a worker or primary, optionally with a handle.
+ *
+ * In the primary, this sends a message to a specific worker. It is identical to [`ChildProcess.send()`](https://nodejs.org/docs/latest-v20.x/api/child_process.html#subprocesssendmessage-sendhandle-options-callback).
+ *
+ * In a worker, this sends a message to the primary. It is identical to `process.send()`.
+ *
+ * This example will echo back all messages from the primary:
+ *
+ * ```js
+ * if (cluster.isPrimary) {
+ * const worker = cluster.fork();
+ * worker.send('hi there');
+ *
+ * } else if (cluster.isWorker) {
+ * process.on('message', (msg) => {
+ * process.send(msg);
+ * });
+ * }
+ * ```
+ * @since v0.7.0
+ * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles.
+ */
+ send(message: child.Serializable, callback?: (error: Error | null) => void): boolean;
+ send(
+ message: child.Serializable,
+ sendHandle: child.SendHandle,
+ callback?: (error: Error | null) => void,
+ ): boolean;
+ send(
+ message: child.Serializable,
+ sendHandle: child.SendHandle,
+ options?: child.MessageOptions,
+ callback?: (error: Error | null) => void,
+ ): boolean;
+ /**
+ * This function will kill the worker. In the primary worker, it does this by
+ * disconnecting the `worker.process`, and once disconnected, killing with `signal`. In the worker, it does it by killing the process with `signal`.
+ *
+ * The `kill()` function kills the worker process without waiting for a graceful
+ * disconnect, it has the same behavior as `worker.process.kill()`.
+ *
+ * This method is aliased as `worker.destroy()` for backwards compatibility.
+ *
+ * In a worker, `process.kill()` exists, but it is not this function;
+ * it is [`kill()`](https://nodejs.org/docs/latest-v20.x/api/process.html#processkillpid-signal).
+ * @since v0.9.12
+ * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process.
+ */
+ kill(signal?: string): void;
+ destroy(signal?: string): void;
+ /**
+ * In a worker, this function will close all servers, wait for the `'close'` event
+ * on those servers, and then disconnect the IPC channel.
+ *
+ * In the primary, an internal message is sent to the worker causing it to call `.disconnect()` on itself.
+ *
+ * Causes `.exitedAfterDisconnect` to be set.
+ *
+ * After a server is closed, it will no longer accept new connections,
+ * but connections may be accepted by any other listening worker. Existing
+ * connections will be allowed to close as usual. When no more connections exist,
+ * see `server.close()`, the IPC channel to the worker will close allowing it
+ * to die gracefully.
+ *
+ * The above applies _only_ to server connections, client connections are not
+ * automatically closed by workers, and disconnect does not wait for them to close
+ * before exiting.
+ *
+ * In a worker, `process.disconnect` exists, but it is not this function;
+ * it is `disconnect()`.
+ *
+ * Because long living server connections may block workers from disconnecting, it
+ * may be useful to send a message, so application specific actions may be taken to
+ * close them. It also may be useful to implement a timeout, killing a worker if
+ * the `'disconnect'` event has not been emitted after some time.
+ *
+ * ```js
+ * if (cluster.isPrimary) {
+ * const worker = cluster.fork();
+ * let timeout;
+ *
+ * worker.on('listening', (address) => {
+ * worker.send('shutdown');
+ * worker.disconnect();
+ * timeout = setTimeout(() => {
+ * worker.kill();
+ * }, 2000);
+ * });
+ *
+ * worker.on('disconnect', () => {
+ * clearTimeout(timeout);
+ * });
+ *
+ * } else if (cluster.isWorker) {
+ * const net = require('node:net');
+ * const server = net.createServer((socket) => {
+ * // Connections never end
+ * });
+ *
+ * server.listen(8000);
+ *
+ * process.on('message', (msg) => {
+ * if (msg === 'shutdown') {
+ * // Initiate graceful close of any connections to server
+ * }
+ * });
+ * }
+ * ```
+ * @since v0.7.7
+ * @return A reference to `worker`.
+ */
+ disconnect(): void;
+ /**
+ * This function returns `true` if the worker is connected to its primary via its
+ * IPC channel, `false` otherwise. A worker is connected to its primary after it
+ * has been created. It is disconnected after the `'disconnect'` event is emitted.
+ * @since v0.11.14
+ */
+ isConnected(): boolean;
+ /**
+ * This function returns `true` if the worker's process has terminated (either
+ * because of exiting or being signaled). Otherwise, it returns `false`.
+ *
+ * ```js
+ * import cluster from 'node:cluster';
+ * import http from 'node:http';
+ * import { availableParallelism } from 'node:os';
+ * import process from 'node:process';
+ *
+ * const numCPUs = availableParallelism();
+ *
+ * if (cluster.isPrimary) {
+ * console.log(`Primary ${process.pid} is running`);
+ *
+ * // Fork workers.
+ * for (let i = 0; i < numCPUs; i++) {
+ * cluster.fork();
+ * }
+ *
+ * cluster.on('fork', (worker) => {
+ * console.log('worker is dead:', worker.isDead());
+ * });
+ *
+ * cluster.on('exit', (worker, code, signal) => {
+ * console.log('worker is dead:', worker.isDead());
+ * });
+ * } else {
+ * // Workers can share any TCP connection. In this case, it is an HTTP server.
+ * http.createServer((req, res) => {
+ * res.writeHead(200);
+ * res.end(`Current process\n ${process.pid}`);
+ * process.kill(process.pid);
+ * }).listen(8000);
+ * }
+ * ```
+ * @since v0.11.14
+ */
+ isDead(): boolean;
+ /**
+ * This property is `true` if the worker exited due to `.disconnect()`.
+ * If the worker exited any other way, it is `false`. If the
+ * worker has not exited, it is `undefined`.
+ *
+ * The boolean `worker.exitedAfterDisconnect` allows distinguishing between
+ * voluntary and accidental exit, the primary may choose not to respawn a worker
+ * based on this value.
+ *
+ * ```js
+ * cluster.on('exit', (worker, code, signal) => {
+ * if (worker.exitedAfterDisconnect === true) {
+ * console.log('Oh, it was just voluntary – no need to worry');
+ * }
+ * });
+ *
+ * // kill worker
+ * worker.kill();
+ * ```
+ * @since v6.0.0
+ */
+ exitedAfterDisconnect: boolean;
+ /**
+ * events.EventEmitter
+ * 1. disconnect
+ * 2. error
+ * 3. exit
+ * 4. listening
+ * 5. message
+ * 6. online
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "disconnect", listener: () => void): this;
+ addListener(event: "error", listener: (error: Error) => void): this;
+ addListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ addListener(event: "listening", listener: (address: Address) => void): this;
+ addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ addListener(event: "online", listener: () => void): this;
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "disconnect"): boolean;
+ emit(event: "error", error: Error): boolean;
+ emit(event: "exit", code: number, signal: string): boolean;
+ emit(event: "listening", address: Address): boolean;
+ emit(event: "message", message: any, handle: net.Socket | net.Server): boolean;
+ emit(event: "online"): boolean;
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "disconnect", listener: () => void): this;
+ on(event: "error", listener: (error: Error) => void): this;
+ on(event: "exit", listener: (code: number, signal: string) => void): this;
+ on(event: "listening", listener: (address: Address) => void): this;
+ on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ on(event: "online", listener: () => void): this;
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "disconnect", listener: () => void): this;
+ once(event: "error", listener: (error: Error) => void): this;
+ once(event: "exit", listener: (code: number, signal: string) => void): this;
+ once(event: "listening", listener: (address: Address) => void): this;
+ once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ once(event: "online", listener: () => void): this;
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "disconnect", listener: () => void): this;
+ prependListener(event: "error", listener: (error: Error) => void): this;
+ prependListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ prependListener(event: "listening", listener: (address: Address) => void): this;
+ prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ prependListener(event: "online", listener: () => void): this;
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "disconnect", listener: () => void): this;
+ prependOnceListener(event: "error", listener: (error: Error) => void): this;
+ prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this;
+ prependOnceListener(event: "listening", listener: (address: Address) => void): this;
+ prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ prependOnceListener(event: "online", listener: () => void): this;
+ }
+ export interface Cluster extends EventEmitter {
+ disconnect(callback?: () => void): void;
+ /**
+ * Spawn a new worker process.
+ *
+ * This can only be called from the primary process.
+ * @param env Key/value pairs to add to worker process environment.
+ * @since v0.6.0
+ */
+ fork(env?: any): Worker;
+ /** @deprecated since v16.0.0 - use isPrimary. */
+ readonly isMaster: boolean;
+ /**
+ * True if the process is a primary. This is determined by the `process.env.NODE_UNIQUE_ID`. If `process.env.NODE_UNIQUE_ID`
+ * is undefined, then `isPrimary` is `true`.
+ * @since v16.0.0
+ */
+ readonly isPrimary: boolean;
+ /**
+ * True if the process is not a primary (it is the negation of `cluster.isPrimary`).
+ * @since v0.6.0
+ */
+ readonly isWorker: boolean;
+ /**
+ * The scheduling policy, either `cluster.SCHED_RR` for round-robin or `cluster.SCHED_NONE` to leave it to the operating system. This is a
+ * global setting and effectively frozen once either the first worker is spawned, or [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
+ * is called, whichever comes first.
+ *
+ * `SCHED_RR` is the default on all operating systems except Windows. Windows will change to `SCHED_RR` once libuv is able to effectively distribute
+ * IOCP handles without incurring a large performance hit.
+ *
+ * `cluster.schedulingPolicy` can also be set through the `NODE_CLUSTER_SCHED_POLICY` environment variable. Valid values are `'rr'` and `'none'`.
+ * @since v0.11.2
+ */
+ schedulingPolicy: number;
+ /**
+ * After calling [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings)
+ * (or [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)) this settings object will contain
+ * the settings, including the default values.
+ *
+ * This object is not intended to be changed or set manually.
+ * @since v0.7.1
+ */
+ readonly settings: ClusterSettings;
+ /** @deprecated since v16.0.0 - use [`.setupPrimary()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clustersetupprimarysettings) instead. */
+ setupMaster(settings?: ClusterSettings): void;
+ /**
+ * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in `cluster.settings`.
+ *
+ * Any settings changes only affect future calls to [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv)
+ * and have no effect on workers that are already running.
+ *
+ * The only attribute of a worker that cannot be set via `.setupPrimary()` is the `env` passed to
+ * [`.fork()`](https://nodejs.org/docs/latest-v20.x/api/cluster.html#clusterforkenv).
+ *
+ * The defaults above apply to the first call only; the defaults for later calls are the current values at the time of
+ * `cluster.setupPrimary()` is called.
+ *
+ * ```js
+ * import cluster from 'node:cluster';
+ *
+ * cluster.setupPrimary({
+ * exec: 'worker.js',
+ * args: ['--use', 'https'],
+ * silent: true,
+ * });
+ * cluster.fork(); // https worker
+ * cluster.setupPrimary({
+ * exec: 'worker.js',
+ * args: ['--use', 'http'],
+ * });
+ * cluster.fork(); // http worker
+ * ```
+ *
+ * This can only be called from the primary process.
+ * @since v16.0.0
+ */
+ setupPrimary(settings?: ClusterSettings): void;
+ /**
+ * A reference to the current worker object. Not available in the primary process.
+ *
+ * ```js
+ * import cluster from 'node:cluster';
+ *
+ * if (cluster.isPrimary) {
+ * console.log('I am primary');
+ * cluster.fork();
+ * cluster.fork();
+ * } else if (cluster.isWorker) {
+ * console.log(`I am worker #${cluster.worker.id}`);
+ * }
+ * ```
+ * @since v0.7.0
+ */
+ readonly worker?: Worker | undefined;
+ /**
+ * A hash that stores the active worker objects, keyed by `id` field. This makes it easy to loop through all the workers. It is only available in the primary process.
+ *
+ * A worker is removed from `cluster.workers` after the worker has disconnected _and_ exited. The order between these two events cannot be determined in advance. However, it
+ * is guaranteed that the removal from the `cluster.workers` list happens before the last `'disconnect'` or `'exit'` event is emitted.
+ *
+ * ```js
+ * import cluster from 'node:cluster';
+ *
+ * for (const worker of Object.values(cluster.workers)) {
+ * worker.send('big announcement to all workers');
+ * }
+ * ```
+ * @since v0.7.0
+ */
+ readonly workers?: NodeJS.Dict | undefined;
+ readonly SCHED_NONE: number;
+ readonly SCHED_RR: number;
+ /**
+ * events.EventEmitter
+ * 1. disconnect
+ * 2. exit
+ * 3. fork
+ * 4. listening
+ * 5. message
+ * 6. online
+ * 7. setup
+ */
+ addListener(event: string, listener: (...args: any[]) => void): this;
+ addListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ addListener(event: "fork", listener: (worker: Worker) => void): this;
+ addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ addListener(
+ event: "message",
+ listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
+ ): this; // the handle is a net.Socket or net.Server object, or undefined.
+ addListener(event: "online", listener: (worker: Worker) => void): this;
+ addListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
+ emit(event: string | symbol, ...args: any[]): boolean;
+ emit(event: "disconnect", worker: Worker): boolean;
+ emit(event: "exit", worker: Worker, code: number, signal: string): boolean;
+ emit(event: "fork", worker: Worker): boolean;
+ emit(event: "listening", worker: Worker, address: Address): boolean;
+ emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean;
+ emit(event: "online", worker: Worker): boolean;
+ emit(event: "setup", settings: ClusterSettings): boolean;
+ on(event: string, listener: (...args: any[]) => void): this;
+ on(event: "disconnect", listener: (worker: Worker) => void): this;
+ on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ on(event: "fork", listener: (worker: Worker) => void): this;
+ on(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ on(event: "online", listener: (worker: Worker) => void): this;
+ on(event: "setup", listener: (settings: ClusterSettings) => void): this;
+ once(event: string, listener: (...args: any[]) => void): this;
+ once(event: "disconnect", listener: (worker: Worker) => void): this;
+ once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ once(event: "fork", listener: (worker: Worker) => void): this;
+ once(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined.
+ once(event: "online", listener: (worker: Worker) => void): this;
+ once(event: "setup", listener: (settings: ClusterSettings) => void): this;
+ prependListener(event: string, listener: (...args: any[]) => void): this;
+ prependListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ prependListener(event: "fork", listener: (worker: Worker) => void): this;
+ prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ prependListener(
+ event: "message",
+ listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void,
+ ): this;
+ prependListener(event: "online", listener: (worker: Worker) => void): this;
+ prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
+ prependOnceListener(event: string, listener: (...args: any[]) => void): this;
+ prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this;
+ prependOnceListener(event: "fork", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this;
+ // the handle is a net.Socket or net.Server object, or undefined.
+ prependOnceListener(
+ event: "message",
+ listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void,
+ ): this;
+ prependOnceListener(event: "online", listener: (worker: Worker) => void): this;
+ prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this;
+ }
+ const cluster: Cluster;
+ export default cluster;
+}
+declare module "node:cluster" {
+ export * from "cluster";
+ export { default as default } from "cluster";
+}
diff --git a/node_modules/@types/node/console.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/console.d.ts
old mode 100755
new mode 100644
similarity index 71%
rename from node_modules/@types/node/console.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/console.d.ts
index ede7a53..3d1a6c2
--- a/node_modules/@types/node/console.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/console.d.ts
@@ -1,15 +1,16 @@
/**
- * The `console` module provides a simple debugging console that is similar to the
- * JavaScript console mechanism provided by web browsers.
+ * The `node:console` module provides a simple debugging console that is similar to
+ * the JavaScript console mechanism provided by web browsers.
*
* The module exports two specific components:
*
- * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
- * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
+ * * A `Console` class with methods such as `console.log()`, `console.error()`, and `console.warn()` that can be used to write to any Node.js stream.
+ * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
+ * [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without calling `require('node:console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
- * asynchronous like all other Node.js streams. See the `note on process I/O` for
+ * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
@@ -53,14 +54,14 @@
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/console.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/console.js)
*/
-declare module 'console' {
- import console = require('node:console');
+declare module "console" {
+ import console = require("node:console");
export = console;
}
-declare module 'node:console' {
- import { InspectOptions } from 'node:util';
+declare module "node:console" {
+ import { InspectOptions } from "node:util";
global {
// This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build
interface Console {
@@ -68,7 +69,8 @@ declare module 'node:console' {
/**
* `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only
* writes a message and does not otherwise affect execution. The output always
- * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`.
+ * starts with `"Assertion failed"`. If provided, `message` is formatted using
+ * [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args).
*
* If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens.
*
@@ -91,7 +93,7 @@ declare module 'node:console' {
* TTY. When `stdout` is not a TTY, this method does nothing.
*
* The specific operation of `console.clear()` can vary across operating systems
- * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the
+ * and terminal types. For most Linux operating systems, `console.clear()` operates similarly to the `clear` shell command. On Windows, `console.clear()` will clear only the output in the
* current terminal viewport for the Node.js
* binary.
* @since v8.3.0
@@ -123,7 +125,7 @@ declare module 'node:console' {
* >
* ```
* @since v8.3.0
- * @param label The display label for the counter.
+ * @param [label='default'] The display label for the counter.
*/
count(label?: string): void;
/**
@@ -141,7 +143,7 @@ declare module 'node:console' {
* >
* ```
* @since v8.3.0
- * @param label The display label for the counter.
+ * @param [label='default'] The display label for the counter.
*/
countReset(label?: string): void;
/**
@@ -150,7 +152,7 @@ declare module 'node:console' {
*/
debug(message?: any, ...optionalParams: any[]): void;
/**
- * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`.
+ * Uses [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) on `obj` and prints the resulting string to `stdout`.
* This function bypasses any custom `inspect()` function defined on `obj`.
* @since v0.1.101
*/
@@ -164,7 +166,8 @@ declare module 'node:console' {
/**
* Prints to `stderr` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
- * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
+ * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
+ * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
*
* ```js
* const code = 5;
@@ -174,13 +177,15 @@ declare module 'node:console' {
* // Prints: error 5, to stderr
* ```
*
- * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string
- * values are concatenated. See `util.format()` for more information.
+ * If formatting elements (e.g. `%d`) are not found in the first string then
+ * [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options) is called on each argument and the
+ * resulting string values are concatenated. See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
+ * for more information.
* @since v0.1.100
*/
error(message?: any, ...optionalParams: any[]): void;
/**
- * Increases indentation of subsequent lines by spaces for `groupIndentation`length.
+ * Increases indentation of subsequent lines by spaces for `groupIndentation` length.
*
* If one or more `label`s are provided, those are printed first without the
* additional indentation.
@@ -193,7 +198,7 @@ declare module 'node:console' {
*/
groupCollapsed(...label: any[]): void;
/**
- * Decreases indentation of subsequent lines by spaces for `groupIndentation`length.
+ * Decreases indentation of subsequent lines by spaces for `groupIndentation` length.
* @since v8.5.0
*/
groupEnd(): void;
@@ -205,7 +210,8 @@ declare module 'node:console' {
/**
* Prints to `stdout` with newline. Multiple arguments can be passed, with the
* first used as the primary message and all additional used as substitution
- * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`).
+ * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html)
+ * (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)).
*
* ```js
* const count = 5;
@@ -215,13 +221,13 @@ declare module 'node:console' {
* // Prints: count: 5, to stdout
* ```
*
- * See `util.format()` for more information.
+ * See [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args) for more information.
* @since v0.1.100
*/
log(message?: any, ...optionalParams: any[]): void;
/**
- * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just
- * logging the argument if it can’t be parsed as tabular.
+ * Try to construct a table with the columns of the properties of `tabularData` (or use `properties`) and rows of `tabularData` and log it. Falls back to just
+ * logging the argument if it can't be parsed as tabular.
*
* ```js
* // These can't be parsed as tabular data
@@ -250,13 +256,14 @@ declare module 'node:console' {
* @since v10.0.0
* @param properties Alternate properties for constructing the table.
*/
- table(tabularData: any, properties?: ReadonlyArray): void;
+ table(tabularData: any, properties?: readonly string[]): void;
/**
* Starts a timer that can be used to compute the duration of an operation. Timers
* are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in
* suitable time units to `stdout`. For example, if the elapsed
* time is 3869ms, `console.timeEnd()` displays "3.869s".
* @since v0.1.104
+ * @param [label='default']
*/
time(label?: string): void;
/**
@@ -264,12 +271,13 @@ declare module 'node:console' {
* prints the result to `stdout`:
*
* ```js
- * console.time('100-elements');
- * for (let i = 0; i < 100; i++) {}
- * console.timeEnd('100-elements');
- * // prints 100-elements: 225.438ms
+ * console.time('bunch-of-stuff');
+ * // Do a bunch of stuff.
+ * console.timeEnd('bunch-of-stuff');
+ * // Prints: bunch-of-stuff: 225.438ms
* ```
* @since v0.1.104
+ * @param [label='default']
*/
timeEnd(label?: string): void;
/**
@@ -285,10 +293,12 @@ declare module 'node:console' {
* console.timeEnd('process');
* ```
* @since v10.7.0
+ * @param [label='default']
*/
timeLog(label?: string, ...data: any[]): void;
/**
- * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code.
+ * Prints to `stderr` the string `'Trace: '`, followed by the [`util.format()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilformatformat-args)
+ * formatted message and stack trace to the current position in the code.
*
* ```js
* console.trace('Show me');
@@ -315,18 +325,32 @@ declare module 'node:console' {
warn(message?: any, ...optionalParams: any[]): void;
// --- Inspector mode only ---
/**
- * This method does not display anything unless used in the inspector.
- * Starts a JavaScript CPU profile with an optional label.
+ * This method does not display anything unless used in the inspector. The `console.profile()`
+ * method starts a JavaScript CPU profile with an optional label until {@link profileEnd}
+ * is called. The profile is then added to the Profile panel of the inspector.
+ *
+ * ```js
+ * console.profile('MyLabel');
+ * // Some code
+ * console.profileEnd('MyLabel');
+ * // Adds the profile 'MyLabel' to the Profiles panel of the inspector.
+ * ```
+ * @since v8.0.0
*/
profile(label?: string): void;
/**
- * This method does not display anything unless used in the inspector.
- * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector.
+ * This method does not display anything unless used in the inspector. Stops the current
+ * JavaScript CPU profiling session if one has been started and prints the report to the
+ * Profiles panel of the inspector. See {@link profile} for an example.
+ *
+ * If this method is called without a label, the most recently started profile is stopped.
+ * @since v8.0.0
*/
profileEnd(label?: string): void;
/**
- * This method does not display anything unless used in the inspector.
- * Adds an event with the label `label` to the Timeline panel of the inspector.
+ * This method does not display anything unless used in the inspector. The `console.timeStamp()`
+ * method adds an event with the label `'label'` to the Timeline panel of the inspector.
+ * @since v8.0.0
*/
timeStamp(label?: string): void;
}
@@ -336,12 +360,13 @@ declare module 'node:console' {
*
* The module exports two specific components:
*
- * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream.
- * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`.
+ * * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream.
+ * * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstdout) and
+ * [`process.stderr`](https://nodejs.org/docs/latest-v20.x/api/process.html#processstderr). The global `console` can be used without calling `require('console')`.
*
* _**Warning**_: The global console object's methods are neither consistently
* synchronous like the browser APIs they resemble, nor are they consistently
- * asynchronous like all other Node.js streams. See the `note on process I/O` for
+ * asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v20.x/api/process.html#a-note-on-process-io) for
* more information.
*
* Example using the global `console`:
@@ -385,25 +410,40 @@ declare module 'node:console' {
* myConsole.warn(`Danger ${name}! Danger!`);
* // Prints: Danger Will Robinson! Danger!, to err
* ```
- * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.11.1/lib/console.js)
*/
namespace console {
interface ConsoleConstructorOptions {
stdout: NodeJS.WritableStream;
stderr?: NodeJS.WritableStream | undefined;
+ /**
+ * Ignore errors when writing to the underlying streams.
+ * @default true
+ */
ignoreErrors?: boolean | undefined;
- colorMode?: boolean | 'auto' | undefined;
+ /**
+ * Set color support for this `Console` instance. Setting to true enables coloring while inspecting
+ * values. Setting to `false` disables coloring while inspecting values. Setting to `'auto'` makes color
+ * support depend on the value of the `isTTY` property and the value returned by `getColorDepth()` on the
+ * respective stream. This option can not be used, if `inspectOptions.colors` is set as well.
+ * @default auto
+ */
+ colorMode?: boolean | "auto" | undefined;
+ /**
+ * Specifies options that are passed along to
+ * [`util.inspect()`](https://nodejs.org/docs/latest-v20.x/api/util.html#utilinspectobject-options).
+ */
inspectOptions?: InspectOptions | undefined;
/**
- * Set group indentation
+ * Set group indentation.
* @default 2
*/
groupIndentation?: number | undefined;
}
interface ConsoleConstructor {
prototype: Console;
- new (stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
- new (options: ConsoleConstructorOptions): Console;
+ new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console;
+ new(options: ConsoleConstructorOptions): Console;
}
}
var console: Console;
diff --git a/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/constants.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/constants.d.ts
new file mode 100644
index 0000000..c3ac2b8
--- /dev/null
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/constants.d.ts
@@ -0,0 +1,19 @@
+/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */
+declare module "constants" {
+ import { constants as osConstants, SignalConstants } from "node:os";
+ import { constants as cryptoConstants } from "node:crypto";
+ import { constants as fsConstants } from "node:fs";
+
+ const exp:
+ & typeof osConstants.errno
+ & typeof osConstants.priority
+ & SignalConstants
+ & typeof cryptoConstants
+ & typeof fsConstants;
+ export = exp;
+}
+
+declare module "node:constants" {
+ import constants = require("constants");
+ export = constants;
+}
diff --git a/node_modules/@types/node/crypto.d.ts b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/crypto.d.ts
old mode 100755
new mode 100644
similarity index 70%
rename from node_modules/@types/node/crypto.d.ts
rename to node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/crypto.d.ts
index 4f6dc9f..10683ed
--- a/node_modules/@types/node/crypto.d.ts
+++ b/node_modules/.deno/@types+node@20.16.5/node_modules/@types/node/crypto.d.ts
@@ -1,9 +1,10 @@
/**
- * The `crypto` module provides cryptographic functionality that includes a set of
- * wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify functions.
+ * The `node:crypto` module provides cryptographic functionality that includes a
+ * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify
+ * functions.
*
* ```js
- * const { createHmac } = await import('crypto');
+ * const { createHmac } = await import('node:crypto');
*
* const secret = 'abcdefg';
* const hash = createHmac('sha256', secret)
@@ -13,12 +14,64 @@
* // Prints:
* // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e
* ```
- * @see [source](https://github.com/nodejs/node/blob/v16.9.0/lib/crypto.js)
+ * @see [source](https://github.com/nodejs/node/blob/v20.13.1/lib/crypto.js)
*/
-declare module 'crypto' {
- import * as stream from 'node:stream';
- import { PeerCertificate } from 'node:tls';
- interface Certificate {
+declare module "crypto" {
+ import * as stream from "node:stream";
+ import { PeerCertificate } from "node:tls";
+ /**
+ * SPKAC is a Certificate Signing Request mechanism originally implemented by
+ * Netscape and was specified formally as part of HTML5's `keygen` element.
+ *
+ * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects
+ * should not use this element anymore.
+ *
+ * The `node:crypto` module provides the `Certificate` class for working with SPKAC
+ * data. The most common usage is handling output generated by the HTML5 `` element. Node.js uses [OpenSSL's SPKAC
+ * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally.
+ * @since v0.11.8
+ */
+ class Certificate {
+ /**
+ * ```js
+ * const { Certificate } = await import('node:crypto');
+ * const spkac = getSpkacSomehow();
+ * const challenge = Certificate.exportChallenge(spkac);
+ * console.log(challenge.toString('utf8'));
+ * // Prints: the challenge as a UTF8 string
+ * ```
+ * @since v9.0.0
+ * @param encoding The `encoding` of the `spkac` string.
+ * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge.
+ */
+ static exportChallenge(spkac: BinaryLike): Buffer;
+ /**
+ * ```js
+ * const { Certificate } = await import('node:crypto');
+ * const spkac = getSpkacSomehow();
+ * const publicKey = Certificate.exportPublicKey(spkac);
+ * console.log(publicKey);
+ * // Prints: the public key as
+ * ```
+ * @since v9.0.0
+ * @param encoding The `encoding` of the `spkac` string.
+ * @return The public key component of the `spkac` data structure, which includes a public key and a challenge.
+ */
+ static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
+ /**
+ * ```js
+ * import { Buffer } from 'node:buffer';
+ * const { Certificate } = await import('node:crypto');
+ *
+ * const spkac = getSpkacSomehow();
+ * console.log(Certificate.verifySpkac(Buffer.from(spkac)));
+ * // Prints: true or false
+ * ```
+ * @since v9.0.0
+ * @param encoding The `encoding` of the `spkac` string.
+ * @return `true` if the given `spkac` data structure is valid, `false` otherwise.
+ */
+ static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
/**
* @deprecated
* @param spkac
@@ -42,41 +95,18 @@ declare module 'crypto' {
*/
verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
}
- const Certificate: Certificate & {
- /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
- new (): Certificate;
- /** @deprecated since v14.9.0 - Use static methods of `crypto.Certificate` instead. */
- (): Certificate;
- /**
- * @param spkac
- * @returns The challenge component of the `spkac` data structure,
- * which includes a public key and a challenge.
- */
- exportChallenge(spkac: BinaryLike): Buffer;
- /**
- * @param spkac
- * @param encoding The encoding of the spkac string.
- * @returns The public key component of the `spkac` data structure,
- * which includes a public key and a challenge.
- */
- exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer;
- /**
- * @param spkac
- * @returns `true` if the given `spkac` data structure is valid,
- * `false` otherwise.
- */
- verifySpkac(spkac: NodeJS.ArrayBufferView): boolean;
- };
namespace constants {
- // https://nodejs.org/dist/latest-v10.x/docs/api/crypto.html#crypto_crypto_constants
+ // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants
const OPENSSL_VERSION_NUMBER: number;
/** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */
const SSL_OP_ALL: number;
+ /** Instructs OpenSSL to allow a non-[EC]DHE-based key exchange mode for TLS v1.3 */
+ const SSL_OP_ALLOW_NO_DHE_KEX: number;
/** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number;
/** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */
const SSL_OP_CIPHER_SERVER_PREFERENCE: number;
- /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */
+ /** Instructs OpenSSL to use Cisco's version identifier of DTLS_BAD_VER. */
const SSL_OP_CISCO_ANYCONNECT: number;
/** Instructs OpenSSL to turn on cookie exchange. */
const SSL_OP_COOKIE_EXCHANGE: number;
@@ -84,39 +114,33 @@ declare module 'crypto' {
const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number;
/** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */
const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number;
- /** Instructs OpenSSL to always use the tmp_rsa key when performing RSA operations. */
- const SSL_OP_EPHEMERAL_RSA: number;
/** Allows initial connection to servers that do not support RI. */
const SSL_OP_LEGACY_SERVER_CONNECT: number;
- const SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER: number;
- const SSL_OP_MICROSOFT_SESS_ID_BUG: number;
- /** Instructs OpenSSL to disable the workaround for a man-in-the-middle protocol-version vulnerability in the SSL 2.0 server implementation. */
- const SSL_OP_MSIE_SSLV2_RSA_PADDING: number;
- const SSL_OP_NETSCAPE_CA_DN_BUG: number;
- const SSL_OP_NETSCAPE_CHALLENGE_BUG: number;
- const SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG: number;
- const SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG: number;
/** Instructs OpenSSL to disable support for SSL/TLS compression. */
const SSL_OP_NO_COMPRESSION: number;
+ /** Instructs OpenSSL to disable encrypt-then-MAC. */
+ const SSL_OP_NO_ENCRYPT_THEN_MAC: number;
const SSL_OP_NO_QUERY_MTU: number;
+ /** Instructs OpenSSL to disable renegotiation. */
+ const SSL_OP_NO_RENEGOTIATION: number;
/** Instructs OpenSSL to always start a new session when performing renegotiation. */
const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number;
+ /** Instructs OpenSSL to turn off SSL v2 */
const SSL_OP_NO_SSLv2: number;
+ /** Instructs OpenSSL to turn off SSL v3 */
const SSL_OP_NO_SSLv3: number;
+ /** Instructs OpenSSL to disable use of RFC4507bis tickets. */
const SSL_OP_NO_TICKET: number;
+ /** Instructs OpenSSL to turn off TLS v1 */
const SSL_OP_NO_TLSv1: number;
+ /** Instructs OpenSSL to turn off TLS v1.1 */
const SSL_OP_NO_TLSv1_1: number;
+ /** Instructs OpenSSL to turn off TLS v1.2 */
const SSL_OP_NO_TLSv1_2: number;
- const SSL_OP_PKCS1_CHECK_1: number;
- const SSL_OP_PKCS1_CHECK_2: number;
- /** Instructs OpenSSL to always create a new key when using temporary/ephemeral DH parameters. */
- const SSL_OP_SINGLE_DH_USE: number;
- /** Instructs OpenSSL to always create a new key when using temporary/ephemeral ECDH parameters. */
- const SSL_OP_SINGLE_ECDH_USE: number;
- const SSL_OP_SSLEAY_080_CLIENT_DH_BUG: number;
- const SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG: number;
- const SSL_OP_TLS_BLOCK_PADDING_BUG: number;
- const SSL_OP_TLS_D5_BUG: number;
+ /** Instructs OpenSSL to turn off TLS v1.3 */
+ const SSL_OP_NO_TLSv1_3: number;
+ /** Instructs OpenSSL server to prioritize ChaCha20-Poly1305 when the client does. This option has no effect if `SSL_OP_CIPHER_SERVER_PREFERENCE` is not enabled. */
+ const SSL_OP_PRIORITIZE_CHACHA: number;
/** Instructs OpenSSL to disable version rollback attack detection. */
const SSL_OP_TLS_ROLLBACK_BUG: number;
const ENGINE_METHOD_RSA: number;
@@ -134,7 +158,6 @@ declare module 'crypto' {
const DH_CHECK_P_NOT_PRIME: number;
const DH_UNABLE_TO_CHECK_GENERATOR: number;
const DH_NOT_SUITABLE_GENERATOR: number;
- const ALPN_ENABLED: number;
const RSA_PKCS1_PADDING: number;
const RSA_SSLV23_PADDING: number;
const RSA_NO_PADDING: number;
@@ -172,19 +195,19 @@ declare module 'crypto' {
*
* The `algorithm` is dependent on the available algorithms supported by the
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
- * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
* display the available digest algorithms.
*
* Example: generating the sha256 sum of a file
*
* ```js
* import {
- * createReadStream
- * } from 'fs';
- * import { argv } from 'process';
+ * createReadStream,
+ * } from 'node:fs';
+ * import { argv } from 'node:process';
* const {
- * createHash
- * } = await import('crypto');
+ * createHash,
+ * } = await import('node:crypto');
*
* const filename = argv[2];
*
@@ -212,22 +235,24 @@ declare module 'crypto' {
*
* The `algorithm` is dependent on the available algorithms supported by the
* version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc.
- * On recent releases of OpenSSL, `openssl list -digest-algorithms`(`openssl list-message-digest-algorithms` for older versions of OpenSSL) will
+ * On recent releases of OpenSSL, `openssl list -digest-algorithms` will
* display the available digest algorithms.
*
* The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is
- * a `KeyObject`, its type must be `secret`.
+ * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was
+ * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not
+ * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256).
*
* Example: generating the sha256 HMAC of a file
*
* ```js
* import {
- * createReadStream
- * } from 'fs';
- * import { argv } from 'process';
+ * createReadStream,
+ * } from 'node:fs';
+ * import { argv } from 'node:process';
* const {
- * createHmac
- * } = await import('crypto');
+ * createHmac,
+ * } = await import('node:crypto');
*
* const filename = argv[2];
*
@@ -250,11 +275,11 @@ declare module 'crypto' {
*/
function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac;
// https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
- type BinaryToTextEncoding = 'base64' | 'base64url' | 'hex';
- type CharacterEncoding = 'utf8' | 'utf-8' | 'utf16le' | 'latin1';
- type LegacyCharacterEncoding = 'ascii' | 'binary' | 'ucs2' | 'ucs-2';
+ type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary";
+ type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1";
+ type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2";
type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding;
- type ECDHKeyFormat = 'compressed' | 'uncompressed' | 'hybrid';
+ type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid";
/**
* The `Hash` class is a utility for creating hash digests of data. It can be
* used in one of two ways:
@@ -270,8 +295,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * createHash
- * } = await import('crypto');
+ * createHash,
+ * } = await import('node:crypto');
*
* const hash = createHash('sha256');
*
@@ -293,9 +318,9 @@ declare module 'crypto' {
* Example: Using `Hash` and piped streams:
*
* ```js
- * import { createReadStream } from 'fs';
- * import { stdout } from 'process';
- * const { createHash } = await import('crypto');
+ * import { createReadStream } from 'node:fs';
+ * import { stdout } from 'node:process';
+ * const { createHash } = await import('node:crypto');
*
* const hash = createHash('sha256');
*
@@ -307,8 +332,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * createHash
- * } = await import('crypto');
+ * createHash,
+ * } = await import('node:crypto');
*
* const hash = createHash('sha256');
*
@@ -335,8 +360,8 @@ declare module 'crypto' {
* ```js
* // Calculate a rolling hash.
* const {
- * createHash
- * } = await import('crypto');
+ * createHash,
+ * } = await import('node:crypto');
*
* const hash = createHash('sha256');
*
@@ -354,7 +379,7 @@ declare module 'crypto' {
* @since v13.1.0
* @param options `stream.transform` options
*/
- copy(options?: stream.TransformOptions): Hash;
+ copy(options?: HashOptions): Hash;
/**
* Updates the hash content with the given `data`, the encoding of which
* is given in `inputEncoding`.
@@ -395,8 +420,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * createHmac
- * } = await import('crypto');
+ * createHmac,
+ * } = await import('node:crypto');
*
* const hmac = createHmac('sha256', 'a secret');
*
@@ -418,11 +443,11 @@ declare module 'crypto' {
* Example: Using `Hmac` and piped streams:
*
* ```js
- * import { createReadStream } from 'fs';
- * import { stdout } from 'process';
+ * import { createReadStream } from 'node:fs';
+ * import { stdout } from 'node:process';
* const {
- * createHmac
- * } = await import('crypto');
+ * createHmac,
+ * } = await import('node:crypto');
*
* const hmac = createHmac('sha256', 'a secret');
*
@@ -434,8 +459,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * createHmac
- * } = await import('crypto');
+ * createHmac,
+ * } = await import('node:crypto');
*
* const hmac = createHmac('sha256', 'a secret');
*
@@ -445,6 +470,7 @@ declare module 'crypto' {
* // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
* ```
* @since v0.1.94
+ * @deprecated Since v20.13.0 Calling `Hmac` class directly with `Hmac()` or `new Hmac()` is deprecated due to being internals, not intended for public use. Please use the {@link createHmac} method to create Hmac instances.
*/
class Hmac extends stream.Transform {
private constructor();
@@ -473,15 +499,15 @@ declare module 'crypto' {
digest(): Buffer;
digest(encoding: BinaryToTextEncoding): string;
}
- type KeyObjectType = 'secret' | 'public' | 'private';
+ type KeyObjectType = "secret" | "public" | "private";
interface KeyExportOptions {
- type: 'pkcs1' | 'spki' | 'pkcs8' | 'sec1';
+ type: "pkcs1" | "spki" | "pkcs8" | "sec1";
format: T;
cipher?: string | undefined;
passphrase?: string | Buffer | undefined;
}
interface JwkKeyExportOptions {
- format: 'jwk';
+ format: "jwk";
}
interface JsonWebKey {
crv?: string | undefined;
@@ -548,13 +574,13 @@ declare module 'crypto' {
* Example: Converting a `CryptoKey` instance to a `KeyObject`:
*
* ```js
- * const { webcrypto, KeyObject } = await import('crypto');
- * const { subtle } = webcrypto;
+ * const { KeyObject } = await import('node:crypto');
+ * const { subtle } = globalThis.crypto;
*
* const key = await subtle.generateKey({
* name: 'HMAC',
* hash: 'SHA-256',
- * length: 256
+ * length: 256,
* }, true, ['sign', 'verify']);
*
* const keyObject = KeyObject.from(key);
@@ -625,9 +651,16 @@ declare module 'crypto' {
* PKCS#1 and SEC1 encryption.
* @since v11.6.0
*/
- export(options: KeyExportOptions<'pem'>): string | Buffer;
- export(options?: KeyExportOptions<'der'>): Buffer;
+ export(options: KeyExportOptions<"pem">): string | Buffer;
+ export(options?: KeyExportOptions<"der">): Buffer;
export(options?: JwkKeyExportOptions): JsonWebKey;
+ /**
+ * Returns `true` or `false` depending on whether the keys have exactly the same
+ * type, value, and parameters. This method is not [constant time](https://en.wikipedia.org/wiki/Timing_attack).
+ * @since v17.7.0, v16.15.0
+ * @param otherKeyObject A `KeyObject` with which to compare `keyObject`.
+ */
+ equals(otherKeyObject: KeyObject): boolean;
/**
* For secret keys, this property represents the size of the key in bytes. This
* property is `undefined` for asymmetric keys.
@@ -641,9 +674,9 @@ declare module 'crypto' {
*/
type: KeyObjectType;
}
- type CipherCCMTypes = 'aes-128-ccm' | 'aes-192-ccm' | 'aes-256-ccm' | 'chacha20-poly1305';
- type CipherGCMTypes = 'aes-128-gcm' | 'aes-192-gcm' | 'aes-256-gcm';
- type CipherOCBTypes = 'aes-128-ocb' | 'aes-192-ocb' | 'aes-256-ocb';
+ type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305";
+ type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm";
+ type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb";
type BinaryLike = string | NodeJS.ArrayBufferView;
type CipherKey = BinaryLike | KeyObject;
interface CipherCCMOptions extends stream.TransformOptions {
@@ -656,28 +689,33 @@ declare module 'crypto' {
authTagLength: number;
}
/**
- * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`.
+ * Creates and returns a `Cipher` object that uses the given `algorithm` and `password`.
*
* The `options` argument controls stream behavior and is optional except when a
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
*
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
* display the available cipher algorithms.
*
* The `password` is used to derive the cipher key and initialization vector (IV).
* The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`.
*
+ * **This function is semantically insecure for all**
+ * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
+ * **GCM, or CCM).**
+ *
* The implementation of `crypto.createCipher()` derives keys using the OpenSSL
- * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
* iteration, and no salt. The lack of salt allows dictionary attacks as the same
* password always creates the same key. The low iteration count and
* non-cryptographically secure hash algorithm allow passwords to be tested very
* rapidly.
*
- * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
* developers derive a key and IV on
* their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode
* (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when
@@ -697,12 +735,13 @@ declare module 'crypto' {
* initialization vector (`iv`).
*
* The `options` argument controls stream behavior and is optional except when a
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the
* authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication
* tag that will be returned by `getAuthTag()` and defaults to 16 bytes.
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
*
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
* display the available cipher algorithms.
*
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
@@ -721,10 +760,30 @@ declare module 'crypto' {
* @since v0.1.94
* @param options `stream.transform` options
*/
- function createCipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): CipherCCM;
- function createCipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): CipherOCB;
- function createCipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): CipherGCM;
- function createCipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Cipher;
+ function createCipheriv(
+ algorithm: CipherCCMTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options: CipherCCMOptions,
+ ): CipherCCM;
+ function createCipheriv(
+ algorithm: CipherOCBTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options: CipherOCBOptions,
+ ): CipherOCB;
+ function createCipheriv(
+ algorithm: CipherGCMTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options?: CipherGCMOptions,
+ ): CipherGCM;
+ function createCipheriv(
+ algorithm: string,
+ key: CipherKey,
+ iv: BinaryLike | null,
+ options?: stream.TransformOptions,
+ ): Cipher;
/**
* Instances of the `Cipher` class are used to encrypt data. The class can be
* used in one of two ways:
@@ -744,8 +803,8 @@ declare module 'crypto' {
* const {
* scrypt,
* randomFill,
- * createCipheriv
- * } = await import('crypto');
+ * createCipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -779,17 +838,17 @@ declare module 'crypto' {
* import {
* createReadStream,
* createWriteStream,
- * } from 'fs';
+ * } from 'node:fs';
*
* import {
- * pipeline
- * } from 'stream';
+ * pipeline,
+ * } from 'node:stream';
*
* const {
* scrypt,
* randomFill,
- * createCipheriv
- * } = await import('crypto');
+ * createCipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -820,8 +879,8 @@ declare module 'crypto' {
* const {
* scrypt,
* randomFill,
- * createCipheriv
- * } = await import('crypto');
+ * createCipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -848,8 +907,8 @@ declare module 'crypto' {
private constructor();
/**
* Updates the cipher with `data`. If the `inputEncoding` argument is given,
- * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`,
- * `TypedArray`, or `DataView`, then`inputEncoding` is ignored.
+ * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or `DataView`. If `data` is a `Buffer`,
+ * `TypedArray`, or `DataView`, then `inputEncoding` is ignored.
*
* The `outputEncoding` specifies the output format of the enciphered
* data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
@@ -896,7 +955,7 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options: {
plaintextLength: number;
- }
+ },
): this;
getAuthTag(): Buffer;
}
@@ -905,7 +964,7 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options?: {
plaintextLength: number;
- }
+ },
): this;
getAuthTag(): Buffer;
}
@@ -914,25 +973,30 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options?: {
plaintextLength: number;
- }
+ },
): this;
getAuthTag(): Buffer;
}
/**
- * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key).
+ * Creates and returns a `Decipher` object that uses the given `algorithm` and `password` (key).
*
* The `options` argument controls stream behavior and is optional except when a
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the
* authentication tag in bytes, see `CCM mode`.
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
+ *
+ * **This function is semantically insecure for all**
+ * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,**
+ * **GCM, or CCM).**
*
* The implementation of `crypto.createDecipher()` derives keys using the OpenSSL
- * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
+ * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one
* iteration, and no salt. The lack of salt allows dictionary attacks as the same
* password always creates the same key. The low iteration count and
* non-cryptographically secure hash algorithm allow passwords to be tested very
* rapidly.
*
- * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man1.1.0/crypto/EVP_BytesToKey.html) it is recommended that
+ * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that
* developers derive a key and IV on
* their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object.
* @since v0.1.94
@@ -945,15 +1009,16 @@ declare module 'crypto' {
/** @deprecated since v10.0.0 use `createDecipheriv()` */
function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher;
/**
- * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`).
+ * Creates and returns a `Decipher` object that uses the given `algorithm`, `key` and initialization vector (`iv`).
*
* The `options` argument controls stream behavior and is optional except when a
- * cipher in CCM or OCB mode is used (e.g. `'aes-128-ccm'`). In that case, the`authTagLength` option is required and specifies the length of the
- * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags
+ * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the `authTagLength` option is required and specifies the length of the
+ * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength` option is not required but can be used to restrict accepted authentication tags
* to those with the specified length.
+ * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes.
*
* The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On
- * recent OpenSSL releases, `openssl list -cipher-algorithms`(`openssl list-cipher-algorithms` for older versions of OpenSSL) will
+ * recent OpenSSL releases, `openssl list -cipher-algorithms` will
* display the available cipher algorithms.
*
* The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded
@@ -972,10 +1037,30 @@ declare module 'crypto' {
* @since v0.1.94
* @param options `stream.transform` options
*/
- function createDecipheriv(algorithm: CipherCCMTypes, key: CipherKey, iv: BinaryLike, options: CipherCCMOptions): DecipherCCM;
- function createDecipheriv(algorithm: CipherOCBTypes, key: CipherKey, iv: BinaryLike, options: CipherOCBOptions): DecipherOCB;
- function createDecipheriv(algorithm: CipherGCMTypes, key: CipherKey, iv: BinaryLike, options?: CipherGCMOptions): DecipherGCM;
- function createDecipheriv(algorithm: string, key: CipherKey, iv: BinaryLike | null, options?: stream.TransformOptions): Decipher;
+ function createDecipheriv(
+ algorithm: CipherCCMTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options: CipherCCMOptions,
+ ): DecipherCCM;
+ function createDecipheriv(
+ algorithm: CipherOCBTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options: CipherOCBOptions,
+ ): DecipherOCB;
+ function createDecipheriv(
+ algorithm: CipherGCMTypes,
+ key: CipherKey,
+ iv: BinaryLike,
+ options?: CipherGCMOptions,
+ ): DecipherGCM;
+ function createDecipheriv(
+ algorithm: string,
+ key: CipherKey,
+ iv: BinaryLike | null,
+ options?: stream.TransformOptions,
+ ): Decipher;
/**
* Instances of the `Decipher` class are used to decrypt data. The class can be
* used in one of two ways:
@@ -992,11 +1077,11 @@ declare module 'crypto' {
* Example: Using `Decipher` objects as streams:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
* const {
* scryptSync,
- * createDecipheriv
- * } = await import('crypto');
+ * createDecipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -1011,6 +1096,7 @@ declare module 'crypto' {
*
* let decrypted = '';
* decipher.on('readable', () => {
+ * let chunk;
* while (null !== (chunk = decipher.read())) {
* decrypted += chunk.toString('utf8');
* }
@@ -1033,12 +1119,12 @@ declare module 'crypto' {
* import {
* createReadStream,
* createWriteStream,
- * } from 'fs';
- * import { Buffer } from 'buffer';
+ * } from 'node:fs';
+ * import { Buffer } from 'node:buffer';
* const {
* scryptSync,
- * createDecipheriv
- * } = await import('crypto');
+ * createDecipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -1058,11 +1144,11 @@ declare module 'crypto' {
* Example: Using the `decipher.update()` and `decipher.final()` methods:
*
* ```js
- * import { Buffer } from 'buffer';
+ * import { Buffer } from 'node:buffer';
* const {
* scryptSync,
- * createDecipheriv
- * } = await import('crypto');
+ * createDecipheriv,
+ * } = await import('node:crypto');
*
* const algorithm = 'aes-192-cbc';
* const password = 'Password used to generate key';
@@ -1087,11 +1173,11 @@ declare module 'crypto' {
private constructor();
/**
* Updates the decipher with `data`. If the `inputEncoding` argument is given,
- * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is
+ * the `data` argument is a string using the specified encoding. If the `inputEncoding` argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is
* ignored.
*
* The `outputEncoding` specifies the output format of the enciphered
- * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned.
+ * data. If the `outputEncoding` is specified, a string using the specified encoding is returned. If no `outputEncoding` is provided, a `Buffer` is returned.
*
* The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error
* being thrown.
@@ -1114,7 +1200,7 @@ declare module 'crypto' {
final(): Buffer;
final(outputEncoding: BufferEncoding): string;
/**
- * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and
+ * When data has been encrypted without standard block padding, calling `decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and
* removing padding.
*
* Turning auto padding off will only work if the input data's length is a
@@ -1133,7 +1219,7 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options: {
plaintextLength: number;
- }
+ },
): this;
}
interface DecipherGCM extends Decipher {
@@ -1142,7 +1228,7 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options?: {
plaintextLength: number;
- }
+ },
): this;
}
interface DecipherOCB extends Decipher {
@@ -1151,70 +1237,78 @@ declare module 'crypto' {
buffer: NodeJS.ArrayBufferView,
options?: {
plaintextLength: number;
- }
+ },
): this;
}
interface PrivateKeyInput {
key: string | Buffer;
format?: KeyFormat | undefined;
- type?: 'pkcs1' | 'pkcs8' | 'sec1' | undefined;
+ type?: "pkcs1" | "pkcs8" | "sec1" | undefined;
passphrase?: string | Buffer | undefined;
+ encoding?: string | undefined;
}
interface PublicKeyInput {
key: string | Buffer;
format?: KeyFormat | undefined;
- type?: 'pkcs1' | 'spki' | undefined;
+ type?: "pkcs1" | "spki" | undefined;
+ encoding?: string | undefined;
}
/**
- * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
+ * Asynchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`.
*
* ```js
* const {
- * generateKey
- * } = await import('crypto');
+ * generateKey,
+ * } = await import('node:crypto');
*
- * generateKey('hmac', { length: 64 }, (err, key) => {
+ * generateKey('hmac', { length: 512 }, (err, key) => {
* if (err) throw err;
* console.log(key.export().toString('hex')); // 46e..........620
* });
* ```
+ *
+ * The size of a generated HMAC key should not exceed the block size of the
+ * underlying hash function. See {@link createHmac} for more information.
* @since v15.0.0
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
*/
function generateKey(
- type: 'hmac' | 'aes',
+ type: "hmac" | "aes",
options: {
length: number;
},
- callback: (err: Error | null, key: KeyObject) => void
+ callback: (err: Error | null, key: KeyObject) => void,
): void;
/**
- * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`.
+ * Synchronously generates a new random secret key of the given `length`. The `type` will determine which validations will be performed on the `length`.
*
* ```js
* const {
- * generateKeySync
- * } = await import('crypto');
+ * generateKeySync,
+ * } = await import('node:crypto');
*
- * const key = generateKeySync('hmac', { length: 64 });
+ * const key = generateKeySync('hmac', { length: 512 });
* console.log(key.export().toString('hex')); // e89..........41e
* ```
+ *
+ * The size of a generated HMAC key should not exceed the block size of the
+ * underlying hash function. See {@link createHmac} for more information.
* @since v15.0.0
* @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`.
*/
function generateKeySync(
- type: 'hmac' | 'aes',
+ type: "hmac" | "aes",
options: {
length: number;
- }
+ },
): KeyObject;
interface JsonWebKeyInput {
key: JsonWebKey;
- format: 'jwk';
+ format: "jwk";
}
/**
* Creates and returns a new key object containing a private key. If `key` is a
- * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above.
+ * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key` must be an object with the properties described above.
*
* If the private key is encrypted, a `passphrase` must be specified. The length
* of the passphrase is limited to 1024 bytes.
@@ -1223,7 +1317,7 @@ declare module 'crypto' {
function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject;
/**
* Creates and returns a new key object containing a public key. If `key` is a
- * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key;
+ * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject` with type `'private'`, the public key is derived from the given private key;
* otherwise, `key` must be an object with the properties described above.
*
* If the format is `'pem'`, the `'key'` may also be an X.509 certificate.
@@ -1231,7 +1325,7 @@ declare module 'crypto' {
* Because public keys can be derived from private keys, a private key may be
* passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the
* returned `KeyObject` will be `'public'` and that the private key cannot be
- * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned
+ * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type `'private'` is given, a new `KeyObject` with type `'public'` will be returned
* and it will be impossible to extract the private key from the returned object.
* @since v11.6.0
*/
@@ -1257,10 +1351,10 @@ declare module 'crypto' {
* @param options `stream.Writable` options
*/
function createSign(algorithm: string, options?: stream.WritableOptions): Sign;
- type DSAEncoding = 'der' | 'ieee-p1363';
+ type DSAEncoding = "der" | "ieee-p1363";
interface SigningOptions {
/**
- * @See crypto.constants.RSA_PKCS1_PADDING
+ * @see crypto.constants.RSA_PKCS1_PADDING
*/
padding?: number | undefined;
saltLength?: number | undefined;
@@ -1270,10 +1364,12 @@ declare module 'crypto' {
interface SignKeyObjectInput extends SigningOptions {
key: KeyObject;
}
+ interface SignJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {}
interface VerifyKeyObjectInput extends SigningOptions {
key: KeyObject;
}
+ interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {}
type KeyLike = string | Buffer | KeyObject;
/**
* The `Sign` class is a utility for generating signatures. It can be used in one
@@ -1293,11 +1389,11 @@ declare module 'crypto' {
* const {
* generateKeyPairSync,
* createSign,
- * createVerify
- * } = await import('crypto');
+ * createVerify,
+ * } = await import('node:crypto');
*
* const { privateKey, publicKey } = generateKeyPairSync('ec', {
- * namedCurve: 'sect239k1'
+ * namedCurve: 'sect239k1',
* });
*
* const sign = createSign('SHA256');
@@ -1318,8 +1414,8 @@ declare module 'crypto' {
* const {
* generateKeyPairSync,
* createSign,
- * createVerify
- * } = await import('crypto');
+ * createVerify,
+ * } = await import('node:crypto');
*
* const { privateKey, publicKey } = generateKeyPairSync('rsa', {
* modulusLength: 2048,
@@ -1355,7 +1451,7 @@ declare module 'crypto' {
/**
* Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`.
*
- * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
+ * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an
* object, the following additional properties can be passed:
*
* If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned.
@@ -1364,13 +1460,16 @@ declare module 'crypto' {
* called. Multiple calls to `sign.sign()` will result in an error being thrown.
* @since v0.1.92
*/
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer;
- sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, outputFormat: BinaryToTextEncoding): string;
+ sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput): Buffer;
+ sign(
+ privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput | SignJsonWebKeyInput,
+ outputFormat: BinaryToTextEncoding,
+ ): string;
}
/**
* Creates and returns a `Verify` object that uses the given algorithm.
* Use {@link getHashes} to obtain an array of names of the available
- * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior.
+ * signing algorithms. Optional `options` argument controls the `stream.Writable` behavior.
*
* In some cases, a `Verify` instance can be created using the name of a signature
* algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use
@@ -1390,7 +1489,7 @@ declare module 'crypto' {
* * Using the `verify.update()` and `verify.verify()` methods to verify
* the signature.
*
- * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword.
+ * The {@link createVerify} method is used to create `Verify` instances. `Verify` objects are not to be created directly using the `new` keyword.
*
* See `Sign` for examples.
* @since v0.1.92
@@ -1401,7 +1500,7 @@ declare module 'crypto' {
* Updates the `Verify` content with the given `data`, the encoding of which
* is given in `inputEncoding`.
* If `inputEncoding` is not provided, and the `data` is a string, an
- * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored.
+ * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or `DataView`, then `inputEncoding` is ignored.
*
* This can be called many times with new data as it is streamed.
* @since v0.1.92
@@ -1412,13 +1511,13 @@ declare module 'crypto' {
/**
* Verifies the provided data using the given `object` and `signature`.
*
- * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an
+ * If `object` is not a `KeyObject`, this function behaves as if `object` had been passed to {@link createPublicKey}. If it is an
* object, the following additional properties can be passed:
*
* The `signature` argument is the previously calculated signature for the data, in
* the `signatureEncoding`.
* If a `signatureEncoding` is specified, the `signature` is expected to be a
- * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
+ * string; otherwise `signature` is expected to be a `Buffer`, `TypedArray`, or `DataView`.
*
* The `verify` object can not be used again after `verify.verify()` has been
* called. Multiple calls to `verify.verify()` will result in an error being
@@ -1428,14 +1527,21 @@ declare module 'crypto' {
* be passed instead of a public key.
* @since v0.1.92
*/
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: NodeJS.ArrayBufferView): boolean;
- verify(object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput, signature: string, signature_format?: BinaryToTextEncoding): boolean;
+ verify(
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
+ signature: NodeJS.ArrayBufferView,
+ ): boolean;
+ verify(
+ object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput,
+ signature: string,
+ signature_format?: BinaryToTextEncoding,
+ ): boolean;
}
/**
* Creates a `DiffieHellman` key exchange object using the supplied `prime` and an
* optional specific `generator`.
*
- * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used.
+ * The `generator` argument can be a number, string, or `Buffer`. If `generator` is not specified, the value `2` is used.
*
* If `primeEncoding` is specified, `prime` is expected to be a string; otherwise
* a `Buffer`, `TypedArray`, or `DataView` is expected.
@@ -1447,11 +1553,27 @@ declare module 'crypto' {
* @param [generator=2]
* @param generatorEncoding The `encoding` of the `generator` string.
*/
- function createDiffieHellman(primeLength: number, generator?: number | NodeJS.ArrayBufferView): DiffieHellman;
- function createDiffieHellman(prime: NodeJS.ArrayBufferView): DiffieHellman;
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding): DiffieHellman;
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: number | NodeJS.ArrayBufferView): DiffieHellman;
- function createDiffieHellman(prime: string, primeEncoding: BinaryToTextEncoding, generator: string, generatorEncoding: BinaryToTextEncoding): DiffieHellman;
+ function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman;
+ function createDiffieHellman(
+ prime: ArrayBuffer | NodeJS.ArrayBufferView,
+ generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
+ ): DiffieHellman;
+ function createDiffieHellman(
+ prime: ArrayBuffer | NodeJS.ArrayBufferView,
+ generator: string,
+ generatorEncoding: BinaryToTextEncoding,
+ ): DiffieHellman;
+ function createDiffieHellman(
+ prime: string,
+ primeEncoding: BinaryToTextEncoding,
+ generator?: number | ArrayBuffer | NodeJS.ArrayBufferView,
+ ): DiffieHellman;
+ function createDiffieHellman(
+ prime: string,
+ primeEncoding: BinaryToTextEncoding,
+ generator: string,
+ generatorEncoding: BinaryToTextEncoding,
+ ): DiffieHellman;
/**
* The `DiffieHellman` class is a utility for creating Diffie-Hellman key
* exchanges.
@@ -1459,11 +1581,11 @@ declare module 'crypto' {
* Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* const {
- * createDiffieHellman
- * } = await import('crypto');
+ * createDiffieHellman,
+ * } = await import('node:crypto');
*
* // Generate Alice's keys...
* const alice = createDiffieHellman(2048);
@@ -1485,10 +1607,15 @@ declare module 'crypto' {
class DiffieHellman {
private constructor();
/**
- * Generates private and public Diffie-Hellman key values, and returns
+ * Generates private and public Diffie-Hellman key values unless they have been
+ * generated or computed already, and returns
* the public key in the specified `encoding`. This key should be
* transferred to the other party.
* If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
+ *
+ * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular,
+ * once a private key has been generated or set, calling this function only updates
+ * the public key but does not generate a new private key.
* @since v0.5.0
* @param encoding The `encoding` of the return value.
*/
@@ -1500,7 +1627,7 @@ declare module 'crypto' {
* key is interpreted using the specified `inputEncoding`, and secret is
* encoded using specified `outputEncoding`.
* If the `inputEncoding` is not
- * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
+ * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`.
*
* If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned.
* @since v0.5.0
@@ -1509,8 +1636,16 @@ declare module 'crypto' {
*/
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer;
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer;
- computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding: null, outputEncoding: BinaryToTextEncoding): string;
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
+ computeSecret(
+ otherPublicKey: NodeJS.ArrayBufferView,
+ inputEncoding: null,
+ outputEncoding: BinaryToTextEncoding,
+ ): string;
+ computeSecret(
+ otherPublicKey: string,
+ inputEncoding: BinaryToTextEncoding,
+ outputEncoding: BinaryToTextEncoding,
+ ): string;
/**
* Returns the Diffie-Hellman prime in the specified `encoding`.
* If `encoding` is provided a string is
@@ -1548,7 +1683,7 @@ declare module 'crypto' {
getPrivateKey(): Buffer;
getPrivateKey(encoding: BinaryToTextEncoding): string;
/**
- * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected
+ * Sets the Diffie-Hellman public key. If the `encoding` argument is provided, `publicKey` is expected
* to be a string. If no `encoding` is provided, `publicKey` is expected
* to be a `Buffer`, `TypedArray`, or `DataView`.
* @since v0.5.0
@@ -1560,6 +1695,9 @@ declare module 'crypto' {
* Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected
* to be a string. If no `encoding` is provided, `privateKey` is expected
* to be a `Buffer`, `TypedArray`, or `DataView`.
+ *
+ * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be
+ * used to manually provide the public key or to automatically derive it.
* @since v0.5.0
* @param encoding The `encoding` of the `privateKey` string.
*/
@@ -1569,7 +1707,7 @@ declare module 'crypto' {
* A bit field containing any warnings and/or errors resulting from a check
* performed during initialization of the `DiffieHellman` object.
*
- * The following values are valid for this property (as defined in `constants`module):
+ * The following values are valid for this property (as defined in `node:constants` module):
*
* * `DH_CHECK_P_NOT_SAFE_PRIME`
* * `DH_CHECK_P_NOT_PRIME`
@@ -1608,12 +1746,12 @@ declare module 'crypto' {
(name: string): DiffieHellmanGroup;
readonly prototype: DiffieHellmanGroup;
}
- type DiffieHellmanGroup = Omit;
+ type DiffieHellmanGroup = Omit;
/**
* Creates a predefined `DiffieHellmanGroup` key exchange object. The
- * supported groups are: `'modp1'`, `'modp2'`, `'modp5'` (defined in [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt), but see `Caveats`) and `'modp14'`, `'modp15'`,`'modp16'`, `'modp17'`,
- * `'modp18'` (defined in [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt)). The
- * returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
+ * supported groups are listed in the documentation for `DiffieHellmanGroup`.
+ *
+ * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing
* the keys (with `diffieHellman.setPublicKey()`, for example). The
* advantage of using this method is that the parties do not have to
* generate nor exchange a group modulus beforehand, saving both processor
@@ -1623,8 +1761,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * getDiffieHellman
- * } = await import('crypto');
+ * getDiffieHellman,
+ * } = await import('node:crypto');
* const alice = getDiffieHellman('modp14');
* const bob = getDiffieHellman('modp14');
*
@@ -1648,15 +1786,12 @@ declare module 'crypto' {
/**
* Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2)
* implementation. A selected HMAC digest algorithm specified by `digest` is
- * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
+ * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`.
*
- * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set;
- * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be
+ * The supplied `callback` function is called with two arguments: `err` and `derivedKey`. If an error occurs while deriving the key, `err` will be set;
+ * otherwise `err` will be `null`. By default, the successfully generated `derivedKey` will be passed to the callback as a `Buffer`. An error will be
* thrown if any of the input arguments specify invalid values or types.
*
- * If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
- * please specify a `digest` explicitly.
- *
* The `iterations` argument must be a number set as high as possible. The
* higher the number of iterations, the more secure the derived key will be,
* but will take a longer amount of time to complete.
@@ -1668,8 +1803,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * pbkdf2
- * } = await import('crypto');
+ * pbkdf2,
+ * } = await import('node:crypto');
*
* pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => {
* if (err) throw err;
@@ -1677,36 +1812,28 @@ declare module 'crypto' {
* });
* ```
*
- * The `crypto.DEFAULT_ENCODING` property can be used to change the way the`derivedKey` is passed to the callback. This property, however, has been
- * deprecated and use should be avoided.
- *
- * ```js
- * import crypto from 'crypto';
- * crypto.DEFAULT_ENCODING = 'hex';
- * crypto.pbkdf2('secret', 'salt', 100000, 512, 'sha512', (err, derivedKey) => {
- * if (err) throw err;
- * console.log(derivedKey); // '3745e48...aa39b34'
- * });
- * ```
- *
* An array of supported digest functions can be retrieved using {@link getHashes}.
*
* This API uses libuv's threadpool, which can have surprising and
* negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information.
* @since v0.5.5
*/
- function pbkdf2(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string, callback: (err: Error | null, derivedKey: Buffer) => void): void;
+ function pbkdf2(
+ password: BinaryLike,
+ salt: BinaryLike,
+ iterations: number,
+ keylen: number,
+ digest: string,
+ callback: (err: Error | null, derivedKey: Buffer) => void,
+ ): void;
/**
* Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2)
* implementation. A selected HMAC digest algorithm specified by `digest` is
- * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`.
+ * applied to derive a key of the requested byte length (`keylen`) from the `password`, `salt` and `iterations`.
*
* If an error occurs an `Error` will be thrown, otherwise the derived key will be
* returned as a `Buffer`.
*
- * If `digest` is `null`, `'sha1'` will be used. This behavior is deprecated,
- * please specify a `digest` explicitly.
- *
* The `iterations` argument must be a number set as high as possible. The
* higher the number of iterations, the more secure the derived key will be,
* but will take a longer amount of time to complete.
@@ -1718,40 +1845,36 @@ declare module 'crypto' {
*
* ```js
* const {
- * pbkdf2Sync
- * } = await import('crypto');
+ * pbkdf2Sync,
+ * } = await import('node:crypto');
*
* const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512');
* console.log(key.toString('hex')); // '3745e48...08d59ae'
* ```
*
- * The `crypto.DEFAULT_ENCODING` property may be used to change the way the`derivedKey` is returned. This property, however, is deprecated and use
- * should be avoided.
- *
- * ```js
- * import crypto from 'crypto';
- * crypto.DEFAULT_ENCODING = 'hex';
- * const key = crypto.pbkdf2Sync('secret', 'salt', 100000, 512, 'sha512');
- * console.log(key); // '3745e48...aa39b34'
- * ```
- *
* An array of supported digest functions can be retrieved using {@link getHashes}.
* @since v0.9.3
*/
- function pbkdf2Sync(password: BinaryLike, salt: BinaryLike, iterations: number, keylen: number, digest: string): Buffer;
+ function pbkdf2Sync(
+ password: BinaryLike,
+ salt: BinaryLike,
+ iterations: number,
+ keylen: number,
+ digest: string,
+ ): Buffer;
/**
* Generates cryptographically strong pseudorandom data. The `size` argument
* is a number indicating the number of bytes to generate.
*
* If a `callback` function is provided, the bytes are generated asynchronously
* and the `callback` function is invoked with two arguments: `err` and `buf`.
- * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes.
+ * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The `buf` argument is a `Buffer` containing the generated bytes.
*
* ```js
* // Asynchronous
* const {
- * randomBytes
- * } = await import('crypto');
+ * randomBytes,
+ * } = await import('node:crypto');
*
* randomBytes(256, (err, buf) => {
* if (err) throw err;
@@ -1766,8 +1889,8 @@ declare module 'crypto' {
* ```js
* // Synchronous
* const {
- * randomBytes
- * } = await import('crypto');
+ * randomBytes,
+ * } = await import('node:crypto');
*
* const buf = randomBytes(256);
* console.log(
@@ -1799,7 +1922,7 @@ declare module 'crypto' {
* Return a random integer `n` such that `min <= n < max`. This
* implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias).
*
- * The range (`max - min`) must be less than 248. `min` and `max` must
+ * The range (`max - min`) must be less than 2**48. `min` and `max` must
* be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger).
*
* If the `callback` function is not provided, the random integer is
@@ -1808,8 +1931,8 @@ declare module 'crypto' {
* ```js
* // Asynchronous
* const {
- * randomInt
- * } = await import('crypto');
+ * randomInt,
+ * } = await import('node:crypto');
*
* randomInt(3, (err, n) => {
* if (err) throw err;
@@ -1820,8 +1943,8 @@ declare module 'crypto' {
* ```js
* // Synchronous
* const {
- * randomInt
- * } = await import('crypto');
+ * randomInt,
+ * } = await import('node:crypto');
*
* const n = randomInt(3);
* console.log(`Random number chosen from (0, 1, 2): ${n}`);
@@ -1830,8 +1953,8 @@ declare module 'crypto' {
* ```js
* // With `min` argument
* const {
- * randomInt
- * } = await import('crypto');
+ * randomInt,
+ * } = await import('node:crypto');
*
* const n = randomInt(1, 7);
* console.log(`The dice rolled: ${n}`);
@@ -1849,8 +1972,8 @@ declare module 'crypto' {
* Synchronous version of {@link randomFill}.
*
* ```js
- * import { Buffer } from 'buffer';
- * const { randomFillSync } = await import('crypto');
+ * import { Buffer } from 'node:buffer';
+ * const { randomFillSync } = await import('node:crypto');
*
* const buf = Buffer.alloc(10);
* console.log(randomFillSync(buf).toString('hex'));
@@ -1866,8 +1989,8 @@ declare module 'crypto' {
* Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`.
*
* ```js
- * import { Buffer } from 'buffer';
- * const { randomFillSync } = await import('crypto');
+ * import { Buffer } from 'node:buffer';
+ * const { randomFillSync } = await import('node:crypto');
*
* const a = new Uint32Array(10);
* console.log(Buffer.from(randomFillSync(a).buffer,
@@ -1895,8 +2018,8 @@ declare module 'crypto' {
* If the `callback` function is not provided, an error will be thrown.
*
* ```js
- * import { Buffer } from 'buffer';
- * const { randomFill } = await import('crypto');
+ * import { Buffer } from 'node:buffer';
+ * const { randomFill } = await import('node:crypto');
*
* const buf = Buffer.alloc(10);
* randomFill(buf, (err, buf) => {
@@ -1916,7 +2039,7 @@ declare module 'crypto' {
* });
* ```
*
- * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`.
+ * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as `buffer`.
*
* While this includes instances of `Float32Array` and `Float64Array`, this
* function should not be used to generate random floating-point numbers. The
@@ -1925,8 +2048,8 @@ declare module 'crypto' {
* distribution and have no meaningful lower or upper bounds.
*
* ```js
- * import { Buffer } from 'buffer';
- * const { randomFill } = await import('crypto');
+ * import { Buffer } from 'node:buffer';
+ * const { randomFill } = await import('node:crypto');
*
* const a = new Uint32Array(10);
* randomFill(a, (err, buf) => {
@@ -1962,9 +2085,21 @@ declare module 'crypto' {
* @param [size=buffer.length - offset]
* @param callback `function(err, buf) {}`.
*/
- function randomFill(buffer: T, callback: (err: Error | null, buf: T) => void): void;
- function randomFill(buffer: T, offset: number, callback: (err: Error | null, buf: T) => void): void;
- function randomFill(buffer: T, offset: number, size: number, callback: (err: Error | null, buf: T) => void): void;
+ function randomFill(
+ buffer: T,
+ callback: (err: Error | null, buf: T) => void,
+ ): void;
+ function randomFill(
+ buffer: T,
+ offset: number,
+ callback: (err: Error | null, buf: T) => void,
+ ): void;
+ function randomFill(
+ buffer: T,
+ offset: number,
+ size: number,
+ callback: (err: Error | null, buf: T) => void,
+ ): void;
interface ScryptOptions {
cost?: number | undefined;
blockSize?: number | undefined;
@@ -1984,7 +2119,7 @@ declare module 'crypto' {
*
* When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`.
*
- * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the
+ * The `callback` function is called with two arguments: `err` and `derivedKey`. `err` is an exception object when key derivation fails, otherwise `err` is `null`. `derivedKey` is passed to the
* callback as a `Buffer`.
*
* An exception is thrown when any of the input arguments specify invalid values
@@ -1992,8 +2127,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * scrypt
- * } = await import('crypto');
+ * scrypt,
+ * } = await import('node:crypto');
*
* // Using the factory defaults.
* scrypt('password', 'salt', 64, (err, derivedKey) => {
@@ -2008,8 +2143,19 @@ declare module 'crypto' {
* ```
* @since v10.5.0
*/
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, callback: (err: Error | null, derivedKey: Buffer) => void): void;
- function scrypt(password: BinaryLike, salt: BinaryLike, keylen: number, options: ScryptOptions, callback: (err: Error | null, derivedKey: Buffer) => void): void;
+ function scrypt(
+ password: BinaryLike,
+ salt: BinaryLike,
+ keylen: number,
+ callback: (err: Error | null, derivedKey: Buffer) => void,
+ ): void;
+ function scrypt(
+ password: BinaryLike,
+ salt: BinaryLike,
+ keylen: number,
+ options: ScryptOptions,
+ callback: (err: Error | null, derivedKey: Buffer) => void,
+ ): void;
/**
* Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based
* key derivation function that is designed to be expensive computationally and
@@ -2028,8 +2174,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * scryptSync
- * } = await import('crypto');
+ * scryptSync,
+ * } = await import('node:crypto');
* // Using the factory defaults.
*
* const key1 = scryptSync('password', 'salt', 64);
@@ -2059,8 +2205,8 @@ declare module 'crypto' {
* Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using
* the corresponding private key, for example using {@link privateDecrypt}.
*
- * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
- * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an
+ * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.
*
* Because RSA public keys can be derived from private keys, a private key may
* be passed instead of a public key.
@@ -2071,8 +2217,8 @@ declare module 'crypto' {
* Decrypts `buffer` with `key`.`buffer` was previously encrypted using
* the corresponding private key, for example using {@link privateEncrypt}.
*
- * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an
- * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
+ * If `key` is not a `KeyObject`, this function behaves as if `key` had been passed to {@link createPublicKey}. If it is an
+ * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`.
*
* Because RSA public keys can be derived from private keys, a private key may
* be passed instead of a public key.
@@ -2083,8 +2229,8 @@ declare module 'crypto' {
* Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using
* the corresponding public key, for example using {@link publicEncrypt}.
*
- * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
- * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`.
+ * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an
+ * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_OAEP_PADDING`.
* @since v0.11.14
*/
function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
@@ -2092,16 +2238,16 @@ declare module 'crypto' {
* Encrypts `buffer` with `privateKey`. The returned data can be decrypted using
* the corresponding public key, for example using {@link publicDecrypt}.
*
- * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an
- * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`.
+ * If `privateKey` is not a `KeyObject`, this function behaves as if `privateKey` had been passed to {@link createPrivateKey}. If it is an
+ * object, the `padding` property can be passed. Otherwise, this function uses `RSA_PKCS1_PADDING`.
* @since v1.1.0
*/
function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer;
/**
* ```js
* const {
- * getCiphers
- * } = await import('crypto');
+ * getCiphers,
+ * } = await import('node:crypto');
*
* console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...]
* ```
@@ -2112,8 +2258,8 @@ declare module 'crypto' {
/**
* ```js
* const {
- * getCurves
- * } = await import('crypto');
+ * getCurves,
+ * } = await import('node:crypto');
*
* console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...]
* ```
@@ -2127,7 +2273,8 @@ declare module 'crypto' {
*/
function getFips(): 1 | 0;
/**
- * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. Throws an error if FIPS mode is not available.
+ * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build.
+ * Throws an error if FIPS mode is not available.
* @since v10.0.0
* @param bool `true` to enable FIPS mode.
*/
@@ -2135,8 +2282,8 @@ declare module 'crypto' {
/**
* ```js
* const {
- * getHashes
- * } = await import('crypto');
+ * getHashes,
+ * } = await import('node:crypto');
*
* console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...]
* ```
@@ -2151,11 +2298,11 @@ declare module 'crypto' {
* Instances of the `ECDH` class can be created using the {@link createECDH} function.
*
* ```js
- * import assert from 'assert';
+ * import assert from 'node:assert';
*
* const {
- * createECDH
- * } = await import('crypto');
+ * createECDH,
+ * } = await import('node:crypto');
*
* // Generate Alice's keys...
* const alice = createECDH('secp521r1');
@@ -2187,17 +2334,17 @@ declare module 'crypto' {
* On recent OpenSSL releases, `openssl ecparam -list_curves` will also display
* the name and description of each available elliptic curve.
*
- * If `format` is not specified the point will be returned in `'uncompressed'`format.
+ * If `format` is not specified the point will be returned in `'uncompressed'` format.
*
- * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
+ * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`, `TypedArray`, or `DataView`.
*
* Example (uncompressing a key):
*
* ```js
* const {
* createECDH,
- * ECDH
- * } = await import('crypto');
+ * ECDH,
+ * } = await import('node:crypto');
*
* const ecdh = createECDH('secp256k1');
* ecdh.generateKeys();
@@ -2222,15 +2369,15 @@ declare module 'crypto' {
key: BinaryLike,
curve: string,
inputEncoding?: BinaryToTextEncoding,
- outputEncoding?: 'latin1' | 'hex' | 'base64' | 'base64url',
- format?: 'uncompressed' | 'compressed' | 'hybrid'
+ outputEncoding?: "latin1" | "hex" | "base64" | "base64url",
+ format?: "uncompressed" | "compressed" | "hybrid",
): Buffer | string;
/**
* Generates private and public EC Diffie-Hellman key values, and returns
* the public key in the specified `format` and `encoding`. This key should be
* transferred to the other party.
*
- * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format.
+ * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format.
*
* If `encoding` is provided a string is returned; otherwise a `Buffer` is returned.
* @since v0.11.14
@@ -2245,11 +2392,11 @@ declare module 'crypto' {
* key is interpreted using specified `inputEncoding`, and the returned secret
* is encoded using the specified `outputEncoding`.
* If the `inputEncoding` is not
- * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`.
+ * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`.
*
* If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned.
*
- * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is
+ * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey` lies outside of the elliptic curve. Since `otherPublicKey` is
* usually supplied from a remote user over an insecure network,
* be sure to handle this exception accordingly.
* @since v0.11.14
@@ -2259,7 +2406,11 @@ declare module 'crypto' {
computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer;
computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer;
computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string;
- computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding: BinaryToTextEncoding): string;
+ computeSecret(
+ otherPublicKey: string,
+ inputEncoding: BinaryToTextEncoding,
+ outputEncoding: BinaryToTextEncoding,
+ ): string;
/**
* If `encoding` is specified, a string is returned; otherwise a `Buffer` is
* returned.
@@ -2270,7 +2421,7 @@ declare module 'crypto' {
getPrivateKey(): Buffer;
getPrivateKey(encoding: BinaryToTextEncoding): string;
/**
- * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format.
+ * The `format` argument specifies point encoding and can be `'compressed'` or `'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format.
*
* If `encoding` is specified, a string is returned; otherwise a `Buffer` is
* returned.
@@ -2279,12 +2430,12 @@ declare module 'crypto' {
* @param [format='uncompressed']
* @return The EC Diffie-Hellman public key in the specified `encoding` and `format`.
*/
- getPublicKey(): Buffer;
+ getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer;
getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string;
/**
* Sets the EC Diffie-Hellman private key.
* If `encoding` is provided, `privateKey` is expected
- * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`.
+ * to be a string; otherwise `privateKey` is expected to be a `Buffer`, `TypedArray`, or `DataView`.
*
* If `privateKey` is not valid for the curve specified when the `ECDH` object was
* created, an error is thrown. Upon setting the private key, the associated
@@ -2304,28 +2455,33 @@ declare module 'crypto' {
*/
function createECDH(curveName: string): ECDH;
/**
- * This function is based on a constant-time algorithm.
- * Returns true if `a` is equal to `b`, without leaking timing information that
+ * This function compares the underlying bytes that represent the given `ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time
+ * algorithm.
+ *
+ * This function does not leak timing information that
* would allow an attacker to guess one of the values. This is suitable for
* comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/).
*
* `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they
- * must have the same byte length.
+ * must have the same byte length. An error is thrown if `a` and `b` have
+ * different byte lengths.
*
* If at least one of `a` and `b` is a `TypedArray` with more than one byte per
* entry, such as `Uint16Array`, the result will be computed using the platform
* byte order.
*
+ * **When both of the inputs are `Float32Array`s or `Float64Array`s, this function might return unexpected results due to IEEE 754**
+ * **encoding of floating-point numbers. In particular, neither `x === y` nor `Object.is(x, y)` implies that the byte representations of two floating-point**
+ * **numbers `x` and `y` are equal.**
+ *
* Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code
* is timing-safe. Care should be taken to ensure that the surrounding code does
* not introduce timing vulnerabilities.
* @since v6.6.0
*/
function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean;
- /** @deprecated since v10.0.0 */
- const DEFAULT_ENCODING: BufferEncoding;
- type KeyType = 'rsa' | 'rsa-pss' | 'dsa' | 'ec' | 'ed25519' | 'ed448' | 'x25519' | 'x448';
- type KeyFormat = 'pem' | 'der';
+ type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448";
+ type KeyFormat = "pem" | "der" | "jwk";
interface BasePrivateKeyEncodingOptions {
format: T;
cipher?: string | undefined;
@@ -2344,6 +2500,10 @@ declare module 'crypto' {
* Name of the curve to use
*/
namedCurve: string;
+ /**
+ * Must be `'named'` or `'explicit'`. Default: `'named'`.
+ */
+ paramEncoding?: "explicit" | "named" | undefined;
}
interface RSAKeyPairKeyObjectOptions {
/**
@@ -2400,11 +2560,11 @@ declare module 'crypto' {
*/
publicExponent?: number | undefined;
publicKeyEncoding: {
- type: 'pkcs1' | 'spki';
+ type: "pkcs1" | "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs1' | 'pkcs8';
+ type: "pkcs1" | "pkcs8";
};
}
interface RSAPSSKeyPairOptions {
@@ -2430,11 +2590,11 @@ declare module 'crypto' {
*/
saltLength?: string;
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
interface DSAKeyPairOptions {
@@ -2447,60 +2607,56 @@ declare module 'crypto' {
*/
divisorLength: number;
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
- interface ECKeyPairOptions {
- /**
- * Name of the curve to use.
- */
- namedCurve: string;
+ interface ECKeyPairOptions extends ECKeyPairKeyObjectOptions {
publicKeyEncoding: {
- type: 'pkcs1' | 'spki';
+ type: "pkcs1" | "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'sec1' | 'pkcs8';
+ type: "sec1" | "pkcs8";
};
}
interface ED25519KeyPairOptions {
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
interface ED448KeyPairOptions {
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
interface X25519KeyPairOptions {
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
interface X448KeyPairOptions {
publicKeyEncoding: {
- type: 'spki';
+ type: "spki";
format: PubF;
};
privateKeyEncoding: BasePrivateKeyEncodingOptions & {
- type: 'pkcs8';
+ type: "pkcs8";
};
}
interface KeyPairSyncResult {
@@ -2521,8 +2677,8 @@ declare module 'crypto' {
*
* ```js
* const {
- * generateKeyPairSync
- * } = await import('crypto');
+ * generateKeyPairSync,
+ * } = await import('node:crypto');
*
* const {
* publicKey,
@@ -2531,14 +2687,14 @@ declare module 'crypto' {
* modulusLength: 4096,
* publicKeyEncoding: {
* type: 'spki',
- * format: 'pem'
+ * format: 'pem',
* },
* privateKeyEncoding: {
* type: 'pkcs8',
* format: 'pem',
* cipher: 'aes-256-cbc',
- * passphrase: 'top secret'
- * }
+ * passphrase: 'top secret',
+ * },
* });
* ```
*
@@ -2548,46 +2704,142 @@ declare module 'crypto' {
* @since v10.12.0
* @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`.
*/
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa', options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'rsa-pss', options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'dsa', options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ec', options: ECKeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ec', options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed25519', options: ED25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed25519', options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed448', options: ED448KeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'ed448', options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x25519', options: X25519KeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x25519', options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'pem', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'pem'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x448', options: X448KeyPairOptions<'der', 'der'>): KeyPairSyncResult;
- function generateKeyPairSync(type: 'x448', options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult;
+ function generateKeyPairSync(
+ type: "rsa",
+ options: RSAKeyPairOptions<"pem", "pem">,
+ ): KeyPairSyncResult;
+ function generateKeyPairSync(
+ type: "rsa",
+ options: RSAKeyPairOptions<"pem", "der">,
+ ): KeyPairSyncResult;
+ function generateKeyPairSync(
+ type: "rsa",
+ options: RSAKeyPairOptions<"der", "pem">,
+ ): KeyPairSyncResult