Skip to content

Commit

Permalink
Add flushCompression as an alias for flush
Browse files Browse the repository at this point in the history
Supports use such as:

```javascript
// Not going to write again for a while.  If compression middleware is
// installed let's tell it to flush what we've got through to the client.
if (res.flushCompression) {
    res.flushCompression();
}
```

Currently the `res` object has a `flush` method regardless of whether
compression middleware is installed.  The built-in `flush` method issues a
noisy deprecation warning.  This patch provides an alias for the `flush`
method to allow detection of the compression middleware's `flush`.

This addresses expressjs#72.
  • Loading branch information
gigabo committed Jun 27, 2016
1 parent b9c63ce commit 287d3a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function compression (options) {
var _write = res.write

// flush
res.flush = function flush () {
res.flush = res.flushCompression = function flush() {
if (stream) {
stream.flush()
}
Expand Down

0 comments on commit 287d3a2

Please sign in to comment.