Skip to content

Commit e2227ee

Browse files
committed
Update docs
1 parent d639a95 commit e2227ee

File tree

2 files changed

+60
-21
lines changed

2 files changed

+60
-21
lines changed

docs/Node/Stream.md

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This module provides a low-level wrapper for the Node Stream API.
55
#### `Stream`
66

77
``` purescript
8-
data Stream :: # * -> # ! -> * -> *
8+
data Stream :: # * -> # ! -> *
99
```
1010

1111
A stream.
@@ -14,7 +14,6 @@ The type arguments track, in order:
1414

1515
- Whether reading and/or writing from/to the stream are allowed.
1616
- Effects associated with reading/writing from/to this stream.
17-
- The type of chunks which will be read from/written to this stream (`String` or `Buffer`).
1817

1918
#### `Read`
2019

@@ -59,119 +58,136 @@ A duplex (readable _and_ writable stream)
5958
#### `setEncoding`
6059

6160
``` purescript
62-
setEncoding :: forall w eff. Readable w eff String -> Encoding -> Eff eff Unit
61+
setEncoding :: forall w eff. Readable w eff -> Encoding -> Eff eff Unit
6362
```
6463

65-
Set the encoding used to read chunks from the stream.
64+
Set the encoding used to read chunks as strings from the stream. This
65+
function is useful when you are passing a readable stream to some other
66+
JavaScript library, which already expects an encoding to be set. It
67+
has no effect on the behaviour of the `onDataString` function (because
68+
that function ensures that the encoding is always supplied explicitly).
6669

6770
#### `onData`
6871

6972
``` purescript
70-
onData :: forall w eff a. Readable w eff a -> (a -> Eff eff Unit) -> Eff eff Unit
73+
onData :: forall w eff. Readable w eff -> (Buffer -> Eff eff Unit) -> Eff eff Unit
7174
```
7275

73-
Listen for `data` events.
76+
Listen for `data` events, returning data in a Buffer.
77+
78+
#### `onDataString`
79+
80+
``` purescript
81+
onDataString :: forall w eff. Readable w eff -> Encoding -> (String -> Eff eff Unit) -> Eff eff Unit
82+
```
83+
84+
Listen for `data` events, returning data in a String, which will be
85+
decoded using the given encoding.
7486

7587
#### `onEnd`
7688

7789
``` purescript
78-
onEnd :: forall w eff a. Readable w eff a -> Eff eff Unit -> Eff eff Unit
90+
onEnd :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff Unit
7991
```
8092

8193
Listen for `end` events.
8294

8395
#### `onClose`
8496

8597
``` purescript
86-
onClose :: forall w eff a. Readable w eff a -> Eff eff Unit -> Eff eff Unit
98+
onClose :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff Unit
8799
```
88100

89101
Listen for `close` events.
90102

91103
#### `onError`
92104

93105
``` purescript
94-
onError :: forall w eff a. Readable w eff a -> Eff eff Unit -> Eff eff Unit
106+
onError :: forall w eff. Readable w eff -> Eff eff Unit -> Eff eff Unit
95107
```
96108

97109
Listen for `error` events.
98110

99111
#### `resume`
100112

101113
``` purescript
102-
resume :: forall w eff a. Readable w eff a -> Eff eff Unit
114+
resume :: forall w eff. Readable w eff -> Eff eff Unit
103115
```
104116

105117
Resume reading from the stream.
106118

107119
#### `pause`
108120

109121
``` purescript
110-
pause :: forall w eff a. Readable w eff a -> Eff eff Unit
122+
pause :: forall w eff. Readable w eff -> Eff eff Unit
111123
```
112124

113125
Pause reading from the stream.
114126

115127
#### `isPaused`
116128

117129
``` purescript
118-
isPaused :: forall w eff a. Readable w eff a -> Eff eff Boolean
130+
isPaused :: forall w eff. Readable w eff -> Eff eff Boolean
119131
```
120132

121133
Check whether or not a stream is paused for reading.
122134

123135
#### `pipe`
124136

125137
``` purescript
126-
pipe :: forall r w eff a. Readable w eff a -> Writable r eff a -> Eff eff (Writable r eff a)
138+
pipe :: forall r w eff. Readable w eff -> Writable r eff -> Eff eff (Writable r eff)
127139
```
128140

129141
Read chunks from a readable stream and write them to a writable stream.
130142

131143
#### `write`
132144

133145
``` purescript
134-
write :: forall r eff a. Writable r eff String -> a -> Eff eff Unit -> Eff eff Boolean
146+
write :: forall r eff. Writable r eff -> Buffer -> Eff eff Unit -> Eff eff Boolean
135147
```
136148

137-
Write a chunk to a writable stream.
149+
Write a Buffer to a writable stream.
138150

139151
#### `writeString`
140152

141153
``` purescript
142-
writeString :: forall r eff. Writable r eff String -> Encoding -> String -> Eff eff Unit -> Eff eff Boolean
154+
writeString :: forall r eff. Writable r eff -> Encoding -> String -> Eff eff Unit -> Eff eff Boolean
143155
```
144156

145157
Write a string in the specified encoding to a writable stream.
146158

147159
#### `cork`
148160

149161
``` purescript
150-
cork :: forall r eff a. Writable r eff a -> Eff eff Unit
162+
cork :: forall r eff. Writable r eff -> Eff eff Unit
151163
```
152164

153165
Force buffering of writes.
154166

155167
#### `uncork`
156168

157169
``` purescript
158-
uncork :: forall r eff a. Writable r eff a -> Eff eff Unit
170+
uncork :: forall r eff. Writable r eff -> Eff eff Unit
159171
```
160172

161173
Flush buffered data.
162174

163175
#### `setDefaultEncoding`
164176

165177
``` purescript
166-
setDefaultEncoding :: forall r eff. Writable r eff String -> Encoding -> Eff eff Unit
178+
setDefaultEncoding :: forall r eff. Writable r eff -> Encoding -> Eff eff Unit
167179
```
168180

169-
Set the default encoding used to write chunks to the stream.
181+
Set the default encoding used to write strings to the stream. This function
182+
is useful when you are passing a writable stream to some other JavaScript
183+
library, which already expects a default encoding to be set. It has no
184+
effect on the behaviour of the `writeString` function (because that
185+
function ensures that the encoding is always supplied explicitly).
170186

171187
#### `end`
172188

173189
``` purescript
174-
end :: forall r eff a. Writable r eff a -> Eff eff Unit -> Eff eff Unit
190+
end :: forall r eff. Writable r eff -> Eff eff Unit -> Eff eff Unit
175191
```
176192

177193
End writing data to the stream.

docs/Node/Stream/StdIO.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## Module Node.Stream.StdIO
2+
3+
The standard IO streams for the current process.
4+
5+
#### `stdin`
6+
7+
``` purescript
8+
stdin :: forall eff. Readable () (console :: CONSOLE | eff)
9+
```
10+
11+
#### `stdout`
12+
13+
``` purescript
14+
stdout :: forall eff. Writable () (console :: CONSOLE | eff)
15+
```
16+
17+
#### `stderr`
18+
19+
``` purescript
20+
stderr :: forall eff. Writable () (console :: CONSOLE | eff)
21+
```
22+
23+

0 commit comments

Comments
 (0)