Skip to content

Commit

Permalink
feat: Message readAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonF authored and zackschuster committed Aug 29, 2021
1 parent 63401a0 commit 0516e38
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions smtp/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,18 @@ export class Message {
str.on('end', (err) => callback(err, buffer));
str.on('error', (err) => callback(err, buffer));
}

public readAsync() {
return new Promise<string>((resolve, reject) => {
this.read((err, buffer) => {
if (err != null) {
reject(err);
} else {
resolve(buffer);
}
});
});
}
}

class MessageStream extends Stream {
Expand Down

0 comments on commit 0516e38

Please sign in to comment.