jimp: [Error: Unsupported MIME type: application/octet-stream]

hi , I have got this error when I try to resize uploaded picture . I print out the file object I try to resize.

avatarFile  is  { fieldname: 'avatar',
  originalname: 'IMG_3242.jpg',
  name: 'ae08b661d41e2cc9bac647765a9f2aed.jpg',
  encoding: '7bit',
  mimetype: 'image/jpeg',
  path: '/var/folders/sd/l6z16nv17txfs7n_x0v2r8r40000gn/T/ae08b661d41e2cc9bac647765a9f2aed.jpg',
  extension: 'jpg',
  size: 652690,
  truncated: false,
  buffer: null }

and when I read avatarFile , I got [Error: Unsupported MIME type: application/octet-stream] , do u hv any idea about this issue? thanks

jimp.read(avatarFile.path ,function(err,image){
  ...
})

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 16

Most upvoted comments

Hello, Not the same but something similar here: .write() will throw this error when the folder path doesn’t exist. It also happens when i try to write a filename without extension. I’m just making sure that the folder path is created. Have you tried fs.exists() on that path? maybe it’s a permission problem. Greetings

This problem is relevant when you have a buffer that you want to save, and you know mimetype, but don’t have the file name. For example when you receive form data in a http endpoint. I used multer for that, and it provides me with buffer and mimetype, so I could set it manually, but there is no config or method for that.