expressjs/multer

Multer is not writing the file directly in the folder

開放

#531 建立於 2017年10月5日

 (5 則留言) (0 個反應) (0 位負責人)JavaScript (1,043 個分叉)batch import
awaiting more infohelp wanted

倉庫指標

星標
 (11,136 顆星)
PR 合併指標
 (平均合併 9天 11小時) (30 天內合併 7 個 PR)

描述

Hello, I am uploading files dynamically (different folders based on need):

// Configure multer
let upload = multer({
  storage: multer.diskStorage({
    destination: (req, file, callback) => {
      let homefolder = req.body.folder;
      callback(null, homefolder);
    },
    filename: (req, file, callback) => {
      let filename = req.body.filename;
      callback(null, filename);
    }
  })
});

router.post('/upload', upload.single('file'), ctrlFileUploader.upload);

This is working well, the issue I have noticed is that multer doesn't write the file there exactly, it kinda waits for the file to be uploaded completely and then starts writing the file to the folder. Is this normal or I am doing something wrong?

貢獻者指南