From c02390eb521fdaef29a3b95b02f88842acd60b26 Mon Sep 17 00:00:00 2001 From: "Sheryl G." Date: Thu, 9 Apr 2026 03:30:33 -0500 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74850=20Add=20?= =?UTF-8?q?node-bzip2=20by=20@shadowslasher410?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Kshitij Anurag --- types/node-bzip2/.npmignore | 5 ++++ types/node-bzip2/index.d.ts | 20 ++++++++++++++ types/node-bzip2/node-bzip2-tests.ts | 39 ++++++++++++++++++++++++++++ types/node-bzip2/package.json | 20 ++++++++++++++ types/node-bzip2/tsconfig.json | 22 ++++++++++++++++ 5 files changed, 106 insertions(+) create mode 100644 types/node-bzip2/.npmignore create mode 100644 types/node-bzip2/index.d.ts create mode 100644 types/node-bzip2/node-bzip2-tests.ts create mode 100644 types/node-bzip2/package.json create mode 100644 types/node-bzip2/tsconfig.json diff --git a/types/node-bzip2/.npmignore b/types/node-bzip2/.npmignore new file mode 100644 index 00000000000000..93e307400a5456 --- /dev/null +++ b/types/node-bzip2/.npmignore @@ -0,0 +1,5 @@ +* +!**/*.d.ts +!**/*.d.cts +!**/*.d.mts +!**/*.d.*.ts diff --git a/types/node-bzip2/index.d.ts b/types/node-bzip2/index.d.ts new file mode 100644 index 00000000000000..653f59d3f655de --- /dev/null +++ b/types/node-bzip2/index.d.ts @@ -0,0 +1,20 @@ +/// +export interface CompressOptions { + /** Compression level from 1 (fastest) to 9 (best). Default is 9. */ + level?: number; + /** Buffering behavior, e.g., 'auto'. */ + buffering?: 'auto' | string; +} + +export interface DecompressOptions { + /** Use less memory during decompression at the cost of speed. */ + small?: boolean; +} + +export function compress(input: string | Buffer | Uint8Array, options?: CompressOptions): Buffer; + +export function decompress(input: Buffer | Uint8Array, options?: DecompressOptions): Buffer; + +export function compressAsync(input: string | Buffer | Uint8Array, options?: CompressOptions): Promise; + +export function decompressAsync(input: Buffer | Uint8Array, options?: DecompressOptions): Promise; diff --git a/types/node-bzip2/node-bzip2-tests.ts b/types/node-bzip2/node-bzip2-tests.ts new file mode 100644 index 00000000000000..580e61538585d7 --- /dev/null +++ b/types/node-bzip2/node-bzip2-tests.ts @@ -0,0 +1,39 @@ +import * as bzip2 from 'node-bzip2'; + +interface Result { + data: Buffer | null; + error: Error | null; +} + +async function doCompress(): Promise { + try { + const input = "Hello, world!"; + const compressed = await bzip2.compressAsync(input, { level: 9 }); + return { data: compressed, error: null }; + } catch (e) { + return { data: null, error: e as Error }; + } +} + +async function doDecompress(cResult: Result): Promise { + if (cResult.error || !cResult.data) return cResult; + try { + const decompressed = await bzip2.decompressAsync(cResult.data); + return { data: decompressed, error: null }; + } catch (e) { + return { data: null, error: e as Error }; + } +} + +async function doTest() { + const cResult = await doCompress(); + const dResult = await doDecompress(cResult); + + if (!dResult.error && dResult.data?.toString() === "Hello, world!") { + console.log("Success"); + } else { + console.log("Failure", dResult.error); + } +} + +doTest(); diff --git a/types/node-bzip2/package.json b/types/node-bzip2/package.json new file mode 100644 index 00000000000000..7f0b0796d9e4e0 --- /dev/null +++ b/types/node-bzip2/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "@types/node-bzip2", + "version": "1.0.9999", + "projects": [ + "https://github.com/WilliamVenner/node-bzip2" + ], + "dependencies": { + "@types/node": "*" + }, + "devDependencies": { + "@types/node-bzip2": "workspace:." + }, + "owners": [ + { + "name": "Sheryl Gavin", + "githubUsername": "shadowslasher410" + } + ] +} diff --git a/types/node-bzip2/tsconfig.json b/types/node-bzip2/tsconfig.json new file mode 100644 index 00000000000000..4344a2566d6787 --- /dev/null +++ b/types/node-bzip2/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "node16", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "node-bzip2": ["./index.d.ts"] + } + }, + "files": [ + "index.d.ts", + "node-bzip2-tests.ts" + ] +} From 72bccd28e51523a0a364115bf4143eb98cf049ab Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Thu, 9 Apr 2026 08:31:18 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=F0=9F=A4=96=20dprint=20fmt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/node-bzip2/index.d.ts | 2 +- types/node-bzip2/node-bzip2-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/node-bzip2/index.d.ts b/types/node-bzip2/index.d.ts index 653f59d3f655de..a408a2f6a8eb19 100644 --- a/types/node-bzip2/index.d.ts +++ b/types/node-bzip2/index.d.ts @@ -3,7 +3,7 @@ export interface CompressOptions { /** Compression level from 1 (fastest) to 9 (best). Default is 9. */ level?: number; /** Buffering behavior, e.g., 'auto'. */ - buffering?: 'auto' | string; + buffering?: "auto" | string; } export interface DecompressOptions { diff --git a/types/node-bzip2/node-bzip2-tests.ts b/types/node-bzip2/node-bzip2-tests.ts index 580e61538585d7..7c6ae0f85d36b5 100644 --- a/types/node-bzip2/node-bzip2-tests.ts +++ b/types/node-bzip2/node-bzip2-tests.ts @@ -1,4 +1,4 @@ -import * as bzip2 from 'node-bzip2'; +import * as bzip2 from "node-bzip2"; interface Result { data: Buffer | null; From 004619015a1a9739d9d27f8047d9dd40042999a6 Mon Sep 17 00:00:00 2001 From: pazaderey <106807629+pazaderey@users.noreply.github.com> Date: Thu, 9 Apr 2026 11:41:52 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#74768=20fix(fo?= =?UTF-8?q?rmidable):=20Change=20options.enabledPlugins=20type=20from=20st?= =?UTF-8?q?ring=20to=20PluginFunction=20by=20@pazaderey?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Петр Задерей --- types/formidable/formidable-tests.ts | 2 +- types/formidable/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/formidable/formidable-tests.ts b/types/formidable/formidable-tests.ts index 0d37e8618feaed..3f3585371bbcec 100644 --- a/types/formidable/formidable-tests.ts +++ b/types/formidable/formidable-tests.ts @@ -25,7 +25,7 @@ import * as http from "http"; // arrange const options: Options = { allowEmptyFiles: true, - enabledPlugins: [], + enabledPlugins: [json, querystring], encoding: "utf-8", fileWriteStreamHandler: undefined, hashAlgorithm: false, diff --git a/types/formidable/index.d.ts b/types/formidable/index.d.ts index 709bb1aee1b12b..4e20d493a59373 100644 --- a/types/formidable/index.d.ts +++ b/types/formidable/index.d.ts @@ -193,7 +193,7 @@ declare namespace formidable { */ filename?: (name: string, ext: string, part: Part, form: Formidable) => string; - enabledPlugins?: string[] | undefined; + enabledPlugins?: formidable.PluginFunction[] | undefined; filter?: (part: Part) => boolean; }