micro-upload

1.0.1 • Public • Published

micro-upload

An express-fileupload wrapper for micro

Install

$ npm install --save micro-upload

Usage

'use strict'
 
const { send } = require('micro')
const { upload, move } = require('micro-upload')
 
module.exports = upload(async (req, res) => {
  if (!req.files) {
    return send(res, 400, 'no file uploaded')
  }
 
  let file = req.files.file
  await move(file, `/tmp/uploads/${file.name}`)
  send(res, 200, 'upload success')
})

Authors and Contributors

Julián DuqueGitHub/julianduqueTwitter/@julian_duque

Contributions are welcomed from anyone wanting to improve this project!

License & Copyright

micro-upload is Copyright (c) 2017 Julian Duque and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    1,335
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    1,335
  • 1.0.0
    3

Package Sidebar

Install

npm i micro-upload

Weekly Downloads

282

Version

1.0.1

License

MIT

Last publish

Collaborators

  • julianduque