Merge remote-tracking branch 'upstream/master' into merge_7_25

This commit is contained in:
Ryan Cavanaugh
2016-07-27 10:57:46 -07:00
312 changed files with 30687 additions and 5238 deletions
+3
View File
@@ -5,6 +5,8 @@
/// <reference types="node" />
import StreamModule = require("stream");
import Stream = StreamModule.Stream;
import WritableStream = NodeJS.WritableStream;
import EventEmitter = NodeJS.EventEmitter;
@@ -33,6 +35,7 @@ interface Attachment {
generatedFileName: string; // e.g. 'image.png'
checksum: string; // the md5 hash of the file, e.g. 'e4cef4c6e26037bcf8166905207ea09b'
content: Buffer; // possibly a SlowBuffer
stream: Stream; // a stream to read the attachment if streamAttachments is set to true
}
// emitted with the 'end' event
+2 -1
View File
@@ -1,6 +1,7 @@
import mailparser_mod = require("mailparser");
import MailParser = mailparser_mod.MailParser;
import ParsedMail = mailparser_mod.ParsedMail;
import Attachment = mailparser_mod.Attachment;
var mailparser = new MailParser();
@@ -57,7 +58,7 @@ var mp = new MailParser({
streamAttachments: true
})
mp.on("attachment", function(attachment, mail){
mp.on("attachment", function(attachment : Attachment, mail : ParsedMail){
var output = fs.createWriteStream(attachment.generatedFileName);
attachment.stream.pipe(output);
});