在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:dominhhai/koa-busboy开源软件地址:https://github.com/dominhhai/koa-busboy开源编程语言:JavaScript 100.0%开源软件介绍:koa-busboyA koa's middleware for handling multipart form.
Note that, this middleware supports Installation
Usage
To create middleware, simply call the module function with custom config options as following: const busboy = require('koa-busboy')
const uploader = busboy(options) While, However, you can specify the following options also.
Exampleconst busboy = require('koa-busboy')
const koaRouter = require('koa-router')
const uploader = busboy({
dest: './upload' // default is system temp folder (`os.tmpdir()`)
fnDestFilename: (fieldname, filename) => uuid() + filename
})
const router = koaRouter()
router.post('/upload', uploader, async ctx => {
// fields
// text fields is add to ctx.request.body object
let { name } = ctx.request.body
// files
// uploaded files is add to ctx.request.files array
let fileReadStream = ctx.request.files[0]
}) |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论