tiz-multer

0.0.8 • Public • Published

tiz-multer

multipart tool for tiz

Install

$ npm i tiz-multer -S

Usage

per route middleware as multer do

const multer = require('tiz-multer')
const upload = multer({
  dest: '/data/uploads'
})
 
router.get('/upload', upload.single('image'), async ctx => {
  // blabla
})

as plugin add ctx.upload method

router.get('/upload', async ctx => {
  try {
    await ctx.uploadSingle('image', {
      /* multer options */
      dest: '/uploads/dir'
    })
  } catch (e) {
 
  }
})

Dependencies (3)

Dev Dependencies (6)

Package Sidebar

Install

npm i tiz-multer

Weekly Downloads

0

Version

0.0.8

License

MIT

Last publish

Collaborators

  • magicdawn