From 562625a0636d28e51758e76ba6e95622591c8807 Mon Sep 17 00:00:00 2001 From: Bo Borgerson Date: Wed, 17 Feb 2016 11:42:49 -0800 Subject: [PATCH] Add `flushCompression` as an alias for `flush` 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 https://github.com/expressjs/compression/issues/72. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 05deb305..b667a1bc 100644 --- a/index.js +++ b/index.js @@ -65,7 +65,7 @@ function compression(options) { var stream // flush - res.flush = function flush() { + res.flush = res.flushCompression = function flush() { if (stream) { stream.flush() }