Socket
Book a DemoInstallSign in
Socket

koa2-upload

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

koa2-upload

A middleware for koa2 to handle file upload based on formidable

1.0.4
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

koa2-upload

基于formidable的,适用于koa2的处理文件上传的中间件

安装

npm i --save koa2-upload

使用方法

  const koa = require('koa');
  const app = new Koa();

  const fileHandler = require('koa2-upload');

  app.use(fileHandler({ autoDelete: true }))

  app.use(async (ctx)=>{

    // ctx.fields
    // ctx.files

  })

Options

  • stream: 默认值 false , 设置为true会将上传文件流挂载在ctx.files[key].stream中

  • autoDelete: 默认值 false ,设置为true在请求结束之后会删除本地缓存文件

  • uploadDir: 设置为文件保存路径

  • maxFileSize: 设置上传文件最大字节数

Keywords

koa

FAQs

Package last updated on 31 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.