anacronw / multer-s3

multer storage engine for amazon s3
MIT License
660 stars 190 forks source link

when upload html file uploads it saves as 'application/octet-stream' #124

Closed AIR-FRAME closed 3 years ago

AIR-FRAME commented 5 years ago

function autoContentType (req, file, cb) { file.stream.once('data', function (firstChunk) { var type = fileType(firstChunk) var mime console.log(type); //This type returns null when I upload html file so it saves as application/octet-stream.

LinusU commented 3 years ago

You can provide your own content type function and set whichever content type you want. I believe that file-type is having a hard time detecting the HTML because it's just a text file and doesn't have any signature of magic bytes...