nodemailer: MimeNode.build returns Promise (#41068)

* nodemailer: MimeNode.build returns Promise

* nodemailer: definition for v6.4
This commit is contained in:
Piotr Roszatycki
2019-12-18 16:18:49 +00:00
committed by Orta
parent 12c0935584
commit b0cce3cd2c
3 changed files with 10 additions and 3 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for Nodemailer 6.2
// Type definitions for Nodemailer 6.4
// Project: https://github.com/nodemailer/nodemailer, https://nodemailer.com
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
// Piotr Roszatycki <https://github.com/dex4er>
+2 -1
View File
@@ -87,8 +87,9 @@ declare class MimeNode {
*/
setContent(content: string | Buffer | Readable): this;
/** Generate the message and return it with a callback */
/** Generate the message and return it with a callback or promise */
build(callback: (err: Error | null, buf: Buffer) => void): void;
build(): Promise<Buffer>;
getTransferEncoding(): string;
+7 -1
View File
@@ -1282,13 +1282,19 @@ function mailcomposer_createReadStream_test() {
// build
function mailcomposer_build_test() {
function mailcomposer_build_callback_test() {
const mail = new MailComposer({ from: '...' });
mail.compile().build((err, message) => {
process.stdout.write(message);
});
}
async function mailcomposer_build_promise_test() {
const mail = new MailComposer({ from: '...' });
const message = await mail.compile().build();
process.stdout.write(message);
}
// addressparser
function isAddress(addressOrGroup: addressparser.AddressOrGroup): addressOrGroup is addressparser.Address {