Skip to content

Commit c788a7f

Browse files
committed
Add res.binary().
1 parent d2176e0 commit c788a7f

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

changes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- added: removing `.package` files from `tmp` directory
1414
- added: a new schema implementation (more in docs)
1515
- added: `F.restful2()` has simplified route mechanism (it doesn't use "{id}" param (insert(POST)/update(POST)/delete(DELETE)) with except "GET" method)
16+
- added: `res.binary(buffer, contentType, [type], [download], [headers])`
1617

1718
- updated: `F.route()`, `F.websocket()` and `F.file()` --> now returns `FrameworkRoute` instance instead of `Framework` instance (more in docs)
1819
- updated: `F.load(debug, [types], [path])` supports a new type `service` which enables `F.on('service')`

index.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14508,6 +14508,27 @@ http.ServerResponse.prototype.stream = function(contentType, stream, download, h
1450814508
return self;
1450914509
};
1451014510

14511+
http.ServerResponse.prototype.binary = function(buffer, contentType, type, download, headers) {
14512+
14513+
if (this.success || this.headersSent)
14514+
return this;
14515+
14516+
if (typeof(type) === 'object') {
14517+
var tmp = type;
14518+
type = download;
14519+
download = headers;
14520+
headers = tmp;
14521+
}
14522+
14523+
if (typeof(download) === 'object') {
14524+
headers = download;
14525+
download = headers;
14526+
}
14527+
14528+
F.responseBinary(this.req, this, contentType, buffer, type, download, headers);
14529+
return self;
14530+
};
14531+
1451114532
/**
1451214533
* Responds with an image
1451314534
* @param {String or Stream} filename

0 commit comments

Comments
 (0)