1.1.4 • Published 6 months ago

@types/async-busboy v1.1.4

Weekly downloads
1,174
License
MIT
Repository
github
Last release
6 months ago

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

// Type definitions for async-busboy 1.1
// Project: https://github.com/m4nuC/async-busboy#readme
// Definitions by: Hiroshi Ioka <https://github.com/hirochachacha>
//                 BendingBender <https://github.com/bendingbender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

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: Thu, 06 Jan 2022 17:31:29 GMT
  • Dependencies: @types/busboy
  • Global values: none

Credits

These definitions were written by Hiroshi Ioka, and BendingBender.

1.1.4

6 months ago

1.1.3

7 months ago

1.1.2

8 months ago

1.1.1

2 years ago

1.1.0

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.0

5 years ago