Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add documentation for ending streams early #1263

Merged
merged 1 commit into from
Apr 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/bigquery/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ BigQuery.prototype.job = function(id) {
* .on('end', function() {
* // All rows retrieved.
* });
*
* //-
* // If you anticipate many results, you can end a stream early to prevent
* // unnecessary processing and API requests.
* //-
* bigquery.query(query)
* .on('data', function(row) {
* this.end();
* });
*/
BigQuery.prototype.query = function(options, callback) {
var that = this;
Expand Down
9 changes: 9 additions & 0 deletions lib/datastore/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,15 @@ DatastoreRequest.prototype.insert = function(entities, callback) {
* });
*
* //-
* // If you anticipate many results, you can end a stream early to prevent
* // unnecessary processing and API requests.
* //-
* datastore.runQuery(query)
* .on('data', function (entity) {
* this.end();
* });
*
* //-
* // A keys-only query returns just the keys of the result entities instead of
* // the entities themselves, at lower latency and cost.
* //-
Expand Down
21 changes: 21 additions & 0 deletions lib/dns/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,27 @@ DNS.prototype.createZone = function(name, config, callback) {
*
* @example
* dns.getZones(function(err, zones, apiResponse) {});
*
* //-
* // Get the zones from your project as a readable object stream.
* //-
* dns.getZones()
* .on('error', console.error)
* .on('data', function(zone) {
* // zone is a Zone object.
* })
* .on('end', function() {
* // All zones retrieved.
* });
*
* //-
* // If you anticipate many results, you can end a stream early to prevent
* // unnecessary processing and API requests.
* //-
* dns.getZones()
* .on('data', function(zone) {
* this.end();
* });
*/
DNS.prototype.getZones = function(query, callback) {
var self = this;
Expand Down
9 changes: 9 additions & 0 deletions lib/logging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,15 @@ Logging.prototype.getEntries = function(options, callback) {
* .on('end', function() {
* // All sinks retrieved.
* });
*
* //-
* // If you anticipate many results, you can end a stream early to prevent
* // unnecessary processing and API requests.
* //-
* logging.getSinks()
* .on('data', function(sink) {
* this.end();
* });
*/
Logging.prototype.getSinks = function(options, callback) {
var self = this;
Expand Down