Browse Source

Documentation for FileReadStream

v0.7.4-release
Felix Geisendörfer 15 years ago
parent
commit
a96b5c792e
  1. 41
      doc/api.txt

41
doc/api.txt

@ -783,6 +783,47 @@ Objects returned from +fs.stat()+ and +fs.lstat()+ are of this type.
+stats.isSocket()+:: ... +stats.isSocket()+:: ...
=== +fs.FileReadStream+
[cols="1,2,10",options="header"]
|=========================================================
|Event | Parameters | Notes
|+"open"+ | +fd+ | The file descriptor was opened.
|+"data"+ | +chunk+ | A chunk of data was read.
|+"error"+ | +err+ | An error occured. This stops the stream.
|+"end"+ | | The end of the file was reached.
|+"close"+ | | The file descriptor was closed.
|=========================================================
+fs.createReadStream(path, [options]);+ ::
Returns a new FileReadStream object.
+
+options+ is an object with the following defaults:
+
----------------------------------------
{ "flags": "r"
, "encoding": "binary"
, "mode": 0666
, "bufferSize": 4 * 1024
}
----------------------------------------
+readStream.readable+ ::
A boolean that is +true+ by default, but turns +false+ after an +"error"+
occured, the stream came to an "end", or +forceClose()+ was called.
+readStream.pause()+ ::
Stops the stream from reading further data. No +"data"+ event will be fired
until the stream is resumed.
+readStream.resume()+ ::
Resumes the stream. Together with +pause()+ this useful to throttle reading.
+readStream.forceClose()+ ::
Allows to close the stream before the +"end"+ is reached. No more events other
than +"close"+ will be fired after this method has been called.
== HTTP == HTTP
To use the HTTP server and client one must +require("http")+. To use the HTTP server and client one must +require("http")+.

Loading…
Cancel
Save