mime.extension is not a function
See original GitHub issueEDIT: There is nothing to do with the code block below (with if(mail.attachments)
, it has problem without it as well)
I basically try the code on #16
notifier(imap)
.on('mail', mail => {
console.log(mail);
if(mail.attachments) {
mail.attachments.forEach(function(attachment){
console.log('attachment.generatedFileName',attachment.generatedFileName)
var bufferStream = new stream.Transform();
bufferStream.push(attachment.content);
var output = fs.createWriteStream('/tmp/' + attachment.generatedFileName);
bufferStream.pipe(output);
});
}
})
.start();
I try an email with a basic image attachment and I got this error:
/Users/yasin/dev/maildeneme/node_modules/mail-notifier/node_modules/mailparser/lib/mailparser.js:1407
defaultExt = mime.extension(contentType);
^
TypeError: mime.extension is not a function
at MailParser._generateFileName (/Users/yasin/dev/maildeneme/node_modules/mail-notifier/node_modules/mailparser/lib/mailparser.js:1407:27)
at MailParser._processStateHeader (/Users/yasin/dev/maildeneme/node_modules/mail-notifier/node_modules/mailparser/lib/mailparser.js:309:61)
at MailParser._process (/Users/yasin/dev/maildeneme/node_modules/mail-notifier/node_modules/mailparser/lib/mailparser.js:227:22)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
cannot get file extension with NodeJS and mime package
When i'm using mime.extension() with 'video/avi' mimetype as param, undefined is returned. What is the solution ? I don't want split file ...
Read more >How to use the mime.getType function in mime - Snyk
To help you get started, we've selected a few mime. ... destination, copyVersions) { const extension = path.extname(filePath); const objectConfig = { ACL: ......
Read more >mime - npm
A comprehensive library for mime-type mapping. Latest version: 3.0.0, last published: a year ago. Start using mime in your project by ...
Read more >TypeError: mime.lookup is not a function - Google Groups
I have solved this problem by myself! step 1. change file : node_modules/._connect@1.9.2@connect/lib/middleware/static.js:143.
Read more >mimetypes — Map filenames to MIME types — Python 3.11.1 ...
The functions are the normal interface to this module, ... The extensions are not guaranteed to have been associated with any particular data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve changed the call
defaultExt = mime.extension(contentType);
todefaultExt = mime.getExtension(contentType);
It works.
Cheers