-
Notifications
You must be signed in to change notification settings - Fork 16
/
get-stream.node.txt
45 lines (32 loc) · 2.79 KB
/
get-stream.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
GET-STREAM
ALTERNATIVES ==> #See raw-body
VERSION ==> #9.0.1
#Node/Deno/browsers
ANYSTREAM #ISTREAM, RSTREAM or ASYNC_ITERABLE
#Unless getStreamAsArray(), items must be STR|BUFFER|ARRBUFFER|UINT8ARR|DATAVIEW
getStream
(ANYSTREAM[, OPTS])->>STR #
getStreamAsBuffer
(ANYSTREAM[, OPTS])->>BUFFER #
getStreamAsArrayBuffer
(ANYSTREAM[, OPTS])->>ARRBUFFER #
getStreamAsArray
(ANYSTREAM[, OPTS])->>ARR #
OPTS.maxBuffer #NUM (def: none)
#Rejects PROMISE if more than NUM bytes
#Done incrementally
#ERROR is MaxBufferError instance
ERROR.bufferedData #STR|BUFFER|ARRBUFFER|ARR, with partially read data
/=+===============================+=\
/ : : \
)==: GET-STDIN :==(
\ :_______________________________: /
\=+===============================+=/
VERSION ==> #9.0.0
GET-STDIN()->>STR #Reads whole stdin.
GET-STDIN.buffer()->>BUFFER #If stdin is interactive TTY, returns empty STR|BUFFER.
#If no stdin as input (including child_process.spawn() stdio 'ignore'), returns empty STR|BUFFER
#Note that default child_process.spawn() stdio is 'pipe', i.e. will wait for parent process
#to do childProcess.stdin.end() to complete.