@types/async-busboy
Version:
TypeScript definitions for async-busboy
62 lines (48 loc) • 1.9 kB
Markdown
# Installation
> `npm install --save @types/async-busboy`
# Summary
This package contains type definitions for async-busboy (https://github.com/m4nuC/async-busboy#readme).
# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async-busboy.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/async-busboy/index.d.ts)
````ts
import * as fs from "fs";
import * as http from "http";
import busboy = require("busboy");
export = asyncBusboy;
declare function asyncBusboy(
req: http.IncomingMessage,
options: asyncBusboy.OnFileOptions,
): Promise<asyncBusboy.OnFileResult>;
declare function asyncBusboy(req: http.IncomingMessage, options?: asyncBusboy.Options): Promise<asyncBusboy.Result>;
declare namespace asyncBusboy {
interface Options extends Omit<busboy.BusboyConfig, "headers"> {
headers?: http.IncomingHttpHeaders | undefined;
onFile?: busboy.BusboyEvents["file"] | undefined;
}
type OnFileOptions = WithRequiredProps<Options, "onFile">;
interface Result {
fields: { [key: string]: unknown };
files: FileReadStream[];
}
type OnFileResult = Omit<Result, "files">;
interface FileReadStream extends fs.ReadStream {
fieldname: string;
filename: string;
transferEncoding: string;
encoding: string;
mimeType: string;
mime: string;
}
}
type WithRequiredProps<T extends {}, K extends keyof T> =
& Omit<T, K>
& {
[MK in K]-?: NonNullable<T[MK]>;
};
````
### Additional Details
* Last updated: Mon, 06 Nov 2023 22:41:04 GMT
* Dependencies: [@types/busboy](https://npmjs.com/package/@types/busboy)
# Credits
These definitions were written by [Hiroshi Ioka](https://github.com/hirochachacha), and [BendingBender](https://github.com/bendingbender).