Fork me on GitHub

Class stream.ReadStream


Defined in: stream.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
stream.ReadStream(request, options)

Readable cloud stream.

Field Summary
Field Attributes Field Name and Description
 

Implements readable "A boolean that is true by default, but turns false after an 'error' occurred, the stream came to an 'end', or destroy() was called.

Method Summary
Method Attributes Method Name and Description
 

Implements destroy "Closes the underlying file descriptor.

 

Implements destroySoon

After the write queue is drained, close the file descriptor.

 
end()

End the underlying cloud request.

 

Implements pause

Pauses the incoming 'data' events.

 

Implements resume

Resumes the incoming 'data' events after a pause().

 
setEncoding(encoding)

Implements setEncoding "Makes the data event emit a string instead of a Buffer.

Event Summary
Event Attributes Event Name and Description
 
data(data, meta)

Data event ('data').

 
end(results, meta)

Completion event ('end').

 
error(err)

Error event ('error').

Class Detail
stream.ReadStream(request, options)

Readable cloud stream.

Implements Readable Stream interface.

Parameters:
{request.AuthenticatedRawRequest} request
Request object.
{Object} options Optional
Options object.
{Function} options.errorFn Optional
Function to call with error.
{Function} options.endFn Optional
Function to call with results. Called: endFn(response).
Field Detail
{boolean} readable

Implements readable "A boolean that is true by default, but turns false after an 'error' occurred, the stream came to an 'end', or destroy() was called."

Method Detail
destroy()

Implements destroy "Closes the underlying file descriptor. Stream will not emit any more events."


destroySoon()

Implements destroySoon

After the write queue is drained, close the file descriptor.


end()

End the underlying cloud request.

Typically starts the async code execution.

Note: This function can be called multiple times without bad effect. Calling code has the option to call end() once the request is set up, or leave it to the end user.


pause()

Implements pause

Pauses the incoming 'data' events.


resume()

Implements resume

Resumes the incoming 'data' events after a pause().


setEncoding(encoding)

Implements setEncoding "Makes the data event emit a string instead of a Buffer. encoding can be 'utf8', 'ascii', or 'base64'."

Parameters:
encoding
Event Detail
data(data, meta)

Data event ('data').

Implements Event 'data'

Parameters:
{Object} data
Data chunk.
{Object} meta
Headers, meta object.
{Object} meta.headers Optional
HTTP headers.
{Object} meta.cloudHeaders Optional
Cloud provider headers.
{Object} meta.metadata Optional
Cloud metadata.

end(results, meta)

Completion event ('end').

Implements Event 'end'

Parameters:
{Object} results
Results object.
{Object} meta
Headers, meta object.
{Object} meta.headers Optional
HTTP headers.
{Object} meta.cloudHeaders Optional
Cloud provider headers.
{Object} meta.metadata Optional
Cloud metadata.

error(err)

Error event ('error').

Implements Event 'error'

Parameters:
{Error|errors.CloudError} err
Error object.