Skip to content

Commit

Permalink
Readme tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Sep 19, 2018
1 parent 5daef73 commit e51140a
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions README.md
Expand Up @@ -162,14 +162,7 @@ _Example:_
class MySMTPServer extends SMTPServerAsPromised {
async onData (stream, session) {
console.log(`[${session.id}] onData started`)
session.messageLength = 0

for (let chunk; (chunk = await stream.read());) {
console.log(`[${session.id}] onData got data chunk ${chunk.length} bytes`)
session.messageLength += chunk.length
}

console.log(`[${session.id}] onData finished after reading ${session.messageLength} bytes`)
stream.pipe(process.stdout)
}
}
```
Expand All @@ -180,11 +173,11 @@ class MySMTPServer extends SMTPServerAsPromised {
[`stream.Readable`](https://nodejs.org/api/stream.html#stream_class_stream_readable)
object.

The method is resolved when `stream` is finished. It is rejected if the `stream`
is already finished.
The method blocks SMTP session until `stream` is finished. It breaks session if
`stream` is already finished.

If the method throws an error then the stream is silently consumed to prevent
SMTP stream to be blocked.
If the method throws an error then the `stream` is silently consumed to
prevent SMTP stream to be blocked.

### onError

Expand Down

0 comments on commit e51140a

Please sign in to comment.