Skip to content
Newer
Older
100644 49 lines (32 sloc) 1.09 KB
aed2965 @dominictarr sources.md
authored
1 # Sources
2
3 A source is a stream that is not writable.
b554926 @dominictarr sources go at the start of the pipeline
authored
4 You *must* have a source at the start of a pipeline
aed2965 @dominictarr sources.md
authored
5 for data to move through.
6
bb20a1c @dominictarr throughs.md
authored
7 in general:
aed2965 @dominictarr sources.md
authored
8
9 ``` js
f6891a7 @dominictarr undocument removed functions
authored
10 pull(source, through, sink)
aed2965 @dominictarr sources.md
authored
11 ```
12
d376a5b @timoxley Link to other types.
timoxley authored
13 See also:
14 * [Throughs](https://github.com/dominictarr/pull-stream/blob/master/docs/throughs.md)
15 * [Sinks](https://github.com/dominictarr/pull-stream/blob/master/docs/sinks.md)
16
4f13eda @dominictarr update docs
authored
17 ## values (array | object)
aed2965 @dominictarr sources.md
authored
18
4f13eda @dominictarr update docs
authored
19 create a SourceStream that reads the values from an array or object and then stops.
aed2965 @dominictarr sources.md
authored
20
4f13eda @dominictarr update docs
authored
21 ## keys (array | object)
22
23 stream the key names from an object (or array)
aed2965 @dominictarr sources.md
authored
24
25 ## count (max)
26
27 create a stream that outputs `0 ... max`.
28 by default, `max = Infinity`, see
29 [take](https://github.com/dominictarr/pull-stream/blob/master/docs/throughs.md#take_test)
30
31 ## infinite (generator)
32
33 create an unending stream by repeatedly calling a generator
34 function (by default, `Math.random`)
35 see
36 [take](https://github.com/dominictarr/pull-stream/blob/master/docs/throughs.md#take_test)
37
505b0a9 @dominictarr document empty
authored
38 ## empty
39
40 A stream with no contents (it just ends immediately)
41
42 ``` js
43 pull.empty().pipe(pull.collect(function (err, ary) {
44 console.log(arg)
45 // ==> []
46 })
47 ```
48
Something went wrong with that request. Please try again.