@admoni/upload-module 中文文档教程

发布于 3年前 浏览 2 更新于 3年前

Upload file module

Installation

npm install --save @admoni/upload-module

Usage

const uploadFile = require("@admoni/upload-module")
app.post('/upload', uploadFile(directory, process.env.ID, process.env.SECRET, filetype).single | array | fields, function(req, res, next) {
  res.send('Successfully uploaded ' + req.file.location + ' files!')
  // File - req.file.location
  // Filetype can be image/png, image/gif, image/jpg, application/zip e.t.c
})

// To delete a file
const { deleteFile } = require("@admoni/upload-module")
deleteFile(ID, SECRET, files)
// files is an array of Object, with Key as the key and req.file.key as the value

Upload file module

Installation

npm install --save @admoni/upload-module

Usage

const uploadFile = require("@admoni/upload-module")
app.post('/upload', uploadFile(directory, process.env.ID, process.env.SECRET, filetype).single | array | fields, function(req, res, next) {
  res.send('Successfully uploaded ' + req.file.location + ' files!')
  // File - req.file.location
  // Filetype can be image/png, image/gif, image/jpg, application/zip e.t.c
})

// To delete a file
const { deleteFile } = require("@admoni/upload-module")
deleteFile(ID, SECRET, files)
// files is an array of Object, with Key as the key and req.file.key as the value
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文