mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-01-30 05:27:30 +00:00
@types/async-busboy: add new package
This commit is contained in:
parent
ffdeb117ad
commit
f4e64e383a
16
types/async-busboy/async-busboy-tests.ts
Normal file
16
types/async-busboy/async-busboy-tests.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import Koa = require('koa');
|
||||
import asyncBusboy = require('async-busboy');
|
||||
|
||||
async function middleware(ctx: Koa.Context, next: () => Promise<any>) {
|
||||
const {files, fields} = await asyncBusboy(ctx.req);
|
||||
}
|
||||
|
||||
async function middleware2(ctx: Koa.Context, next: () => Promise<any>) {
|
||||
const {fields} = await asyncBusboy(ctx.req, {
|
||||
limits: {
|
||||
fileSize: 2 * 1024 * 1024,
|
||||
},
|
||||
onFile: (fieldname: string, file: NodeJS.ReadableStream, filename: string, encoding: string, mimetype: string) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
28
types/async-busboy/index.d.ts
vendored
Normal file
28
types/async-busboy/index.d.ts
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
// Type definitions for async-busboy 0.7
|
||||
// Project: https://github.com/m4nuC/async-busboy#readme
|
||||
// Definitions by: Hiroshi Ioka <https://github.com/hirochachacha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
|
||||
import busboy = require('busboy');
|
||||
|
||||
interface Options extends busboy.BusboyConfig {
|
||||
onFile: (
|
||||
fieldname: string,
|
||||
file: NodeJS.ReadableStream,
|
||||
filename: string,
|
||||
encoding: string,
|
||||
mimetype: string) => void;
|
||||
}
|
||||
|
||||
type AsyncBusboy = (
|
||||
req: http.IncomingMessage,
|
||||
options?: Options
|
||||
) => Promise<{fields: {[key: string]: any}; files?: fs.ReadStream[]}>;
|
||||
|
||||
declare const asyncBusboy: AsyncBusboy;
|
||||
|
||||
export = asyncBusboy;
|
||||
23
types/async-busboy/tsconfig.json
Normal file
23
types/async-busboy/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"async-busboy-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/async-busboy/tslint.json
Normal file
1
types/async-busboy/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user