Skip to content

Forward multipart/form-data file upload into a savefiles.org drive.

Notifications You must be signed in to change notification settings

mickeymond/multer-savefilesorg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multer SaveFilesOrg

This is a custom multer storage engine that proxy the received file into a savefiles.org drive. The data is forwarded as multipart/form-data.

Install

npm install --save multer-savefilesorg

Usage

In this example we are forwarding user uploaded file into savefiles.org drive https://savefiles.org/api/v1/uploads, with the file identified with the parameter 'file'.

var multer = require('multer')
var {multerSaveFilesOrg} = require('multer-savefilesorg')

// Configure upload middleware
const upload = multer({
    storage: multerSaveFilesOrg({
        apiAccessToken: process.env.SAVEFILESORG_API_KEY,
        relativePath: '/' // If left blank, this defaults to root of drive '/',
    }),
    preservePath: true
});

// Use upload middleware
router.post('/', upload.single('image'), (req, res, next) => {
  console.log(req.file); // If single upload was done
  console.log(req.files); // If array upload was done
});

License

multer-savefilesorg is released under the MIT license.

About

Forward multipart/form-data file upload into a savefiles.org drive.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%