chensenlai 10988628a0 语音房项目初始化 5 years ago
..
examples 10988628a0 语音房项目初始化 5 years ago
test 10988628a0 语音房项目初始化 5 years ago
.editorconfig 10988628a0 语音房项目初始化 5 years ago
.gitattributes 10988628a0 语音房项目初始化 5 years ago
.jshintrc 10988628a0 语音房项目初始化 5 years ago
.npmignore 10988628a0 语音房项目初始化 5 years ago
.travis.yml 10988628a0 语音房项目初始化 5 years ago
history.md 10988628a0 语音房项目初始化 5 years ago
index.js 10988628a0 语音房项目初始化 5 years ago
license.md 10988628a0 语音房项目初始化 5 years ago
package.json 10988628a0 语音房项目初始化 5 years ago
readme.md 10988628a0 语音房项目初始化 5 years ago

readme.md

koa-better-body NPM version Build Status Dependency Status

A koa body parser middleware with support for multipart, json or urlencoded request bodies. Via formidable and co-body.

Install Nodei.co stats

Install with npm

$ npm install koa-better-body

Examples

For a more comprehensive examples, see examples folder.

Options

However, koa-better-body have few custom options, see also co-body, raw-body, formidable

  • patchNode {Boolean} Patch request body to Node's ctx.req object, default false
  • patchKoa {Boolean} Patch request body to Koa's ctx.request object, default true
  • jsonLimit {String|Number} The byte limit of the JSON body, default 1mb
  • formLimit {String|Number} The byte limit of the form body, default 56kb
  • encoding {String} Sets encoding for incoming form fields, default utf-8
  • multipart {Boolean} Support multipart/form-data request bodies, default false
  • formidable {Object} Options that are passing to formidable
  • formidable.maxFields {Number} See formidable-options. our default 10
  • formidable.multiples {Boolean} See formidable-options, our default true
  • formidable.keepExtensions {Boolean} See formidable-options, our default true
  • return {GeneratorFunction} That you can use with koa or co

formidable options

See node-formidable for a full list of options

  • bytesExpected {Integer} The expected number of bytes in this form, default null
  • maxFields {Integer} Limits the number of fields that the querystring parser will decode, default 1000
  • maxFieldsSize {Integer} Limits the amount of memory a field can allocate in bytes, default 2mb
  • uploadDir {String} Sets the directory for placing file uploads in, default os.tmpDir()
  • hash {String} If you want checksums calculated for incoming files - 'sha1' or 'md5', default false
  • multiples {Boolean} Multiple file uploads or no, default false

Tests

As usual - npm test or if you have mocha globally - mocha --harmony-generators.

$ npm test

Authors & Contributors author tips

Charlike Mike Reagent

Daryl Lau

License MIT license

Copyright (c) 2014 Charlike Mike Reagent, Daryl Lau, contributors.
Released under the MIT license.