-
Notifications
You must be signed in to change notification settings - Fork 378
/
Copy pathnode.js
3173 lines (3171 loc) · 189 KB
/
node.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
return mod(require("../lib/tern"), require("./node_resolve"));
if (typeof define == "function" && define.amd) // AMD
return define(["../lib/tern", "./node_resolve"], mod);
mod(tern, tern);
})(function(tern) {
"use strict";
tern.registerPlugin("node", function(server) {
server.loadPlugin("node_resolve");
server.on("postReset", function() {
var mods = server.mod.modules, locals = server.cx.definitions.node;
for (var name in locals) if (/^[a-z_]*$/.test(name))
mods.knownModules[name] = locals[name];
});
server.addDefs(defs);
});
var defs = {
"!name": "node",
"!define": {
events: {
"!url": "https://nodejs.org/api/events.html",
"!doc": "Many objects in Node emit events: a net.Server emits an event each time a peer connects to it, a fs.readStream emits an event when the file is opened. All objects which emit events are instances of events.EventEmitter.",
EventEmitter: {
prototype: {
addListener: {
"!type": "fn(event: string, listener: fn())",
"!url": "https://nodejs.org/api/events.html#events_emitter_addlistener_eventname_listener",
"!doc": "Adds a listener to the end of the listeners array for the specified event."
},
on: {
"!type": "fn(event: string, listener: fn())",
"!url": "https://nodejs.org/api/events.html#events_emitter_on_eventname_listener",
"!doc": "Adds a listener to the end of the listeners array for the specified event."
},
once: {
"!type": "fn(event: string, listener: fn())",
"!url": "https://nodejs.org/api/events.html#events_emitter_once_eventname_listener",
"!doc": "Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed."
},
removeListener: {
"!type": "fn(event: string, listener: fn())",
"!url": "https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listener",
"!doc": "Remove a listener from the listener array for the specified event. Caution: changes array indices in the listener array behind the listener."
},
removeAllListeners: {
"!type": "fn(event: string)",
"!url": "https://nodejs.org/api/events.html#events_emitter_removealllisteners_eventname",
"!doc": "Removes all listeners, or those of the specified event."
},
setMaxListeners: {
"!type": "fn(n: number)",
"!url": "https://nodejs.org/api/events.html#events_emitter_setmaxlisteners_n",
"!doc": "By default EventEmitters will print a warning if more than 10 listeners are added for a particular event. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited."
},
listeners: {
"!type": "fn(event: string) -> [fn()]",
"!url": "https://nodejs.org/api/events.html#events_emitter_listeners_eventname",
"!doc": "Returns an array of listeners for the specified event."
},
emit: {
"!type": "fn(event: string)",
"!url": "https://nodejs.org/api/events.html#events_emitter_emit_eventname_arg1_arg2",
"!doc": "Execute each of the listeners in order with the supplied arguments."
}
},
"!url": "https://nodejs.org/api/events.html#events_class_eventemitter",
"!doc": "To access the EventEmitter class, require('events').EventEmitter."
}
},
stream: {
"!type": "fn()",
prototype: {
"!proto": "events.EventEmitter.prototype",
pipe: {
"!type": "fn(destination: +stream.Writable, options?: ?)",
"!url": "https://nodejs.org/api/stream.html#stream_readable_pipe_destination_options",
"!doc": "Connects this readable stream to destination WriteStream. Incoming data on this stream gets written to destination. Properly manages back-pressure so that a slow destination will not be overwhelmed by a fast readable stream."
}
},
Writable: {
"!type": "fn(options?: ?)",
prototype: {
"!proto": "stream.prototype",
write: {
"!type": "fn(chunk: string|+Buffer, encoding?: string, callback?: fn()) -> bool",
"!url": "https://nodejs.org/api/stream.html#stream_writable_write_chunk_encoding_callback_1",
"!doc": "Writes chunk to the stream. Returns true if the data has been flushed to the underlying resource. Returns false to indicate that the buffer is full, and the data will be sent out in the future. The 'drain' event will indicate when the buffer is empty again."
},
cork: {
"!type": "fn()",
"!url": "https://nodejs.org/api/stream.html#stream_writable_cork",
"!doc": "Forces buffering of all writes. Buffered data will be flushed either at .uncork() or at .end() call."
},
uncork: {
"!type": "fn()",
"!url": "https://nodejs.org/api/stream.html#stream_writable_uncork",
"!doc": "Flush all data, buffered since .cork() call."
},
setDefaultEncoding: {
"!type": "fn(encoding: string) -> bool",
"!url": "https://nodejs.org/api/stream.html#stream_writable_setdefaultencoding_encoding",
"!doc": "Sets the default encoding for a writable stream. Returns true if the encoding is valid and is set. Otherwise returns false."
},
end: {
"!type": "fn(chunk?: string|+Buffer, encoding?: string, callback?: fn()) -> bool",
"!url": "https://nodejs.org/api/stream.html#stream_writable_end_chunk_encoding_callback",
"!doc": "Call this method to signal the end of the data being written to the stream."
}
},
"!url": "https://nodejs.org/api/stream.html#stream_class_stream_writable",
"!doc": "A Writable Stream has the following methods, members, and events."
},
Readable: {
"!type": "fn(options?: ?)",
prototype: {
"!proto": "stream.prototype",
setEncoding: {
"!type": "fn(encoding: string)",
"!url": "https://nodejs.org/api/stream.html#stream_readable_setencoding_encoding",
"!doc": "Makes the 'data' event emit a string instead of a Buffer. encoding can be 'utf8', 'utf16le' ('ucs2'), 'ascii', or 'hex'."
},
pause: {
"!type": "fn()",
"!url": "https://nodejs.org/api/stream.html#stream_readable_pause",
"!doc": "Switches the readable stream into \"old mode\", where data is emitted using a 'data' event rather than being buffered for consumption via the read() method."
},
resume: {
"!type": "fn()",
"!url": "https://nodejs.org/api/stream.html#stream_readable_resume",
"!doc": "Switches the readable stream into \"old mode\", where data is emitted using a 'data' event rather than being buffered for consumption via the read() method."
},
destroy: "fn()",
unpipe: {
"!type": "fn(dest?: +stream.Writable)",
"!url": "https://nodejs.org/api/stream.html#stream_readable_unpipe_destination",
"!doc": "Undo a previously established pipe(). If no destination is provided, then all previously established pipes are removed."
},
push: {
"!type": "fn(chunk: +Buffer) -> bool",
"!url": "https://nodejs.org/api/stream.html#stream_readable_push_chunk",
"!doc": "Explicitly insert some data into the read queue. If called with null, will signal the end of the data."
},
unshift: {
"!type": "fn(chunk: +Buffer) -> bool",
"!url": "https://nodejs.org/api/stream.html#stream_readable_unshift_chunk",
"!doc": "This is the corollary of readable.push(chunk). Rather than putting the data at the end of the read queue, it puts it at the front of the read queue."
},
wrap: {
"!type": "fn(stream: ?) -> +stream.Readable",
"!url": "https://nodejs.org/api/stream.html#stream_readable_wrap_stream",
"!doc": "If you are using an older Node library that emits 'data' events and has a pause() method that is advisory only, then you can use the wrap() method to create a Readable stream that uses the old stream as its data source."
},
read: {
"!type": "fn(size?: number) -> +Buffer",
"!url": "https://nodejs.org/api/stream.html#stream_readable_read_size_1",
"!doc": "Call this method to consume data once the 'readable' event is emitted."
}
},
"!url": "https://nodejs.org/api/stream.html#stream_class_stream_readable",
"!doc": "A Readable Stream has the following methods, members, and events."
},
Duplex: {
"!type": "fn(options?: ?)",
prototype: {
"!proto": "stream.Readable.prototype",
write: "fn(chunk: +Buffer, encoding?: string, callback?: fn()) -> bool",
end: "fn(chunk: +Buffer, encoding?: string, callback?: fn()) -> bool"
},
"!url": "https://nodejs.org/api/stream.html#stream_class_stream_duplex",
"!doc": "A \"duplex\" stream is one that is both Readable and Writable, such as a TCP socket connection."
},
Transform: {
"!type": "fn(options?: ?)",
prototype: {
"!proto": "stream.Duplex.prototype"
},
"!url": "https://nodejs.org/api/stream.html#stream_class_stream_transform",
"!doc": "A \"transform\" stream is a duplex stream where the output is causally connected in some way to the input, such as a zlib stream or a crypto stream."
},
PassThrough: "stream.Transform",
"!url": "https://nodejs.org/api/stream.html#stream_stream",
"!doc": "A stream is an abstract interface implemented by various objects in Node. For example a request to an HTTP server is a stream, as is stdout. Streams are readable, writable, or both. All streams are instances of EventEmitter"
},
querystring: {
"!url": "https://nodejs.org/api/querystring.html",
"!doc": "This module provides utilities for dealing with query strings.",
stringify: {
"!type": "fn(obj: ?, sep?: string, eq?: string) -> string",
"!url": "https://nodejs.org/api/querystring.html#querystring_querystring_stringify_obj_sep_eq",
"!doc": "Serialize an object to a query string. Optionally override the default separator ('&') and assignment ('=') characters."
},
parse: {
"!type": "fn(str: string, sep?: string, eq?: string, options?: ?) -> ?",
"!url": "https://nodejs.org/api/querystring.html#querystring_querystring_parse_str_sep_eq_options",
"!doc": "Deserialize a query string to an object. Optionally override the default separator ('&') and assignment ('=') characters."
},
escape: {
"!type": "fn(string) -> string",
"!url": "https://nodejs.org/api/querystring.html#querystring_querystring_escape",
"!doc": "The escape function used by querystring.stringify, provided so that it could be overridden if necessary."
},
unescape: {
"!type": "fn(string) -> string",
"!url": "https://nodejs.org/api/querystring.html#querystring_querystring_unescape",
"!doc": "The unescape function used by querystring.parse, provided so that it could be overridden if necessary."
}
},
http: {
"!url": "https://nodejs.org/api/http.html",
"!doc": "The HTTP interfaces in Node are designed to support many features of the protocol which have been traditionally difficult to use. In particular, large, possibly chunk-encoded, messages. The interface is careful to never buffer entire requests or responses--the user is able to stream data.",
STATUS_CODES: {},
createServer: {
"!type": "fn(listener?: fn(request: +http.IncomingMessage, response: +http.ServerResponse)) -> +http.Server",
"!url": "https://nodejs.org/api/http.html#http_http_createserver_requestlistener",
"!doc": "Returns a new web server object."
},
Server: {
"!type": "fn()",
prototype: {
"!proto": "events.EventEmitter.prototype",
listen: {
"!type": "fn(port: number, hostname?: string, backlog?: number, callback?: fn())",
"!url": "https://nodejs.org/api/http.html#http_server_listen_port_hostname_backlog_callback",
"!doc": "Begin accepting connections on the specified port and hostname. If the hostname is omitted, the server will accept connections directed to any IPv4 address (INADDR_ANY)."
},
close: {
"!type": "fn(callback?: ?)",
"!url": "https://nodejs.org/api/http.html#http_server_close_callback",
"!doc": "Stops the server from accepting new connections."
},
maxHeadersCount: {
"!type": "number",
"!url": "https://nodejs.org/api/http.html#http_server_maxheaderscount",
"!doc": "Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - no limit will be applied."
},
setTimeout: {
"!type": "fn(timeout: number, callback?: fn())",
"!url": "https://nodejs.org/api/http.html#http_server_settimeout_msecs_callback",
"!doc": "Sets the timeout value for sockets, and emits a 'timeout' event on the Server object, passing the socket as an argument, if a timeout occurs."
},
timeout: {
"!type": "number",
"!url": "https://nodejs.org/api/http.html#http_server_timeout",
"!doc": "The number of milliseconds of inactivity before a socket is presumed to have timed out."
}
},
"!url": "https://nodejs.org/api/http.html#http_class_http_server",
"!doc": "Class for HTTP server objects."
},
ServerResponse: {
"!type": "fn()",
prototype: {
"!proto": "stream.Writable.prototype",
writeContinue: {
"!type": "fn()",
"!url": "https://nodejs.org/api/http.html#http_response_writecontinue",
"!doc": "Sends a HTTP/1.1 100 Continue message to the client, indicating that the request body should be sent."
},
writeHead: {
"!type": "fn(statusCode: number, headers?: ?)",
"!url": "https://nodejs.org/api/http.html#http_response_writehead_statuscode_reasonphrase_headers",
"!doc": "Sends a response header to the request. The status code is a 3-digit HTTP status code, like 404. The last argument, headers, are the response headers. Optionally one can give a human-readable reasonPhrase as the second argument."
},
setTimeout: {
"!type": "fn(timeout: number, callback?: fn())",
"!url": "https://nodejs.org/api/http.html#http_response_settimeout_msecs_callback",
"!doc": "Sets the Socket's timeout value to msecs. If a callback is provided, then it is added as a listener on the 'timeout' event on the response object."
},
statusCode: {
"!type": "number",
"!url": "https://nodejs.org/api/http.html#http_response_statuscode",
"!doc": "When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed."
},
setHeader: {
"!type": "fn(name: string, value: string)",
"!url": "https://nodejs.org/api/http.html#http_response_setheader_name_value",
"!doc": "Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here if you need to send multiple headers with the same name."
},
headersSent: {
"!type": "bool",
"!url": "https://nodejs.org/api/http.html#http_response_headerssent",
"!doc": "Boolean (read-only). True if headers were sent, false otherwise."
},
sendDate: {
"!type": "bool",
"!url": "https://nodejs.org/api/http.html#http_response_senddate",
"!doc": "When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true."
},
getHeader: {
"!type": "fn(name: string) -> string",
"!url": "https://nodejs.org/api/http.html#http_response_getheader_name",
"!doc": "Reads out a header that's already been queued but not sent to the client. Note that the name is case insensitive. This can only be called before headers get implicitly flushed."
},
removeHeader: {
"!type": "fn(name: string)",
"!url": "https://nodejs.org/api/http.html#http_response_removeheader_name",
"!doc": "Removes a header that's queued for implicit sending."
},
addTrailers: {
"!type": "fn(headers: ?)",
"!url": "https://nodejs.org/api/http.html#http_response_addtrailers_headers",
"!doc": "This method adds HTTP trailing headers (a header but at the end of the message) to the response."
}
},
"!url": "https://nodejs.org/api/http.html#http_class_http_serverresponse",
"!doc": "This object is created internally by a HTTP server--not by the user. It is passed as the second parameter to the 'request' event."
},
request: {
"!type": "fn(options: ?, callback?: fn(res: +http.IncomingMessage)) -> +http.ClientRequest",
"!url": "https://nodejs.org/api/http.html#http_http_request_options_callback",
"!doc": "Node maintains several connections per server to make HTTP requests. This function allows one to transparently issue requests."
},
get: {
"!type": "fn(options: ?, callback?: fn(res: +http.IncomingMessage)) -> +http.ClientRequest",
"!url": "https://nodejs.org/api/http.html#http_http_get_options_callback",
"!doc": "Since most requests are GET requests without bodies, Node provides this convenience method. The only difference between this method and http.request() is that it sets the method to GET and calls req.end() automatically."
},
globalAgent: {
"!type": "+http.Agent",
"!url": "https://nodejs.org/api/http.html#http_http_globalagent",
"!doc": "Global instance of Agent which is used as the default for all http client requests."
},
Agent: {
"!type": "fn()",
prototype: {
maxSockets: {
"!type": "number",
"!url": "https://nodejs.org/api/http.html#http_agent_maxsockets",
"!doc": "By default set to 5. Determines how many concurrent sockets the agent can have open per host."
},
sockets: {
"!type": "[+net.Socket]",
"!url": "https://nodejs.org/api/http.html#http_agent_sockets",
"!doc": "An object which contains arrays of sockets currently in use by the Agent. Do not modify."
},
requests: {
"!type": "[+http.ClientRequest]",
"!url": "https://nodejs.org/api/http.html#http_agent_requests",
"!doc": "An object which contains queues of requests that have not yet been assigned to sockets. Do not modify."
}
},
"!url": "https://nodejs.org/api/http.html#http_class_http_agent",
"!doc": "In node 0.5.3+ there is a new implementation of the HTTP Agent which is used for pooling sockets used in HTTP client requests."
},
ClientRequest: {
"!type": "fn()",
prototype: {
"!proto": "stream.Writable.prototype",
abort: {
"!type": "fn()",
"!url": "https://nodejs.org/api/http.html#http_request_abort",
"!doc": "Aborts a request. (New since v0.3.8.)"
},
setTimeout: {
"!type": "fn(timeout: number, callback?: fn())",
"!url": "https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback",
"!doc": "Once a socket is assigned to this request and is connected socket.setTimeout() will be called."
},
setNoDelay: {
"!type": "fn(noDelay?: fn())",
"!url": "https://nodejs.org/api/http.html#http_request_setnodelay_nodelay",
"!doc": "Once a socket is assigned to this request and is connected socket.setNoDelay() will be called."
},
setSocketKeepAlive: {
"!type": "fn(enable?: bool, initialDelay?: number)",
"!url": "https://nodejs.org/api/http.html#http_request_setsocketkeepalive_enable_initialdelay",
"!doc": "Once a socket is assigned to this request and is connected socket.setKeepAlive() will be called."
}
},
"!url": "https://nodejs.org/api/http.html#http_class_http_clientrequest",
"!doc": "This object is created internally and returned from http.request(). It represents an in-progress request whose header has already been queued. The header is still mutable using the setHeader(name, value), getHeader(name), removeHeader(name) API. The actual header will be sent along with the first data chunk or when closing the connection."
},
IncomingMessage: {
"!type": "fn()",
prototype: {
"!proto": "stream.Readable.prototype",
httpVersion: {
"!type": "string",
"!url": "https://nodejs.org/api/http.html#http_message_httpversion",
"!doc": "In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server. Probably either '1.1' or '1.0'."
},
headers: {
"!type": "?",
"!url": "https://nodejs.org/api/http.html#http_message_headers",
"!doc": "The request/response headers object."
},
trailers: {
"!type": "?",
"!url": "https://nodejs.org/api/http.html#http_message_trailers",
"!doc": "The request/response trailers object. Only populated after the 'end' event."
},
setTimeout: {
"!type": "fn(timeout: number, callback?: fn())",
"!url": "https://nodejs.org/api/http.html#http_message_settimeout_msecs_callback",
"!doc": "Calls message.connection.setTimeout(msecs, callback)."
},
setEncoding: {
"!type": "fn(encoding?: string)",
"!url": "https://nodejs.org/api/http.html#http_message_setencoding_encoding",
"!doc": "Set the encoding for data emitted by the 'data' event."
},
pause: {
"!type": "fn()",
"!url": "https://nodejs.org/api/http.html#http_message_pause",
"!doc": "Pauses request/response from emitting events. Useful to throttle back a download."
},
resume: {
"!type": "fn()",
"!url": "https://nodejs.org/api/http.html#http_message_resume",
"!doc": "Resumes a paused request/response."
},
method: {
"!type": "string",
"!url": "https://nodejs.org/api/http.html#http_message_method",
"!doc": "Only valid for request obtained from http.Server."
},
url: {
"!type": "string",
"!url": "https://nodejs.org/api/http.html#http_message_url",
"!doc": "Only valid for request obtained from http.Server."
},
statusCode: {
"!type": "number",
"!url": "https://nodejs.org/api/http.html#http_message_statuscode",
"!doc": "Only valid for response obtained from http.ClientRequest."
},
socket: {
"!type": "+net.Socket",
"!url": "https://nodejs.org/api/http.html#http_message_socket",
"!doc": "The net.Socket object associated with the connection."
}
},
"!url": "https://nodejs.org/api/http.html#http_http_incomingmessage",
"!doc": "An IncomingMessage object is created by http.Server or http.ClientRequest and passed as the first argument to the 'request' and 'response' event respectively. It may be used to access response status, headers and data."
}
},
https: {
"!url": "https://nodejs.org/api/http.html",
"!doc": "HTTPS is the HTTP protocol over TLS/SSL. In Node this is implemented as a separate module.",
Server: "http.Server",
createServer: {
"!type": "fn(listener?: fn(request: +http.IncomingMessage, response: +http.ServerResponse)) -> +https.Server",
"!url": "https://nodejs.org/api/https.html#https_https_createserver_options_requestlistener",
"!doc": "Returns a new HTTPS web server object. The options is similar to tls.createServer(). The requestListener is a function which is automatically added to the 'request' event."
},
request: {
"!type": "fn(options: ?, callback?: fn(res: +http.IncomingMessage)) -> +http.ClientRequest",
"!url": "https://nodejs.org/api/https.html#https_https_request_options_callback",
"!doc": "Makes a request to a secure web server."
},
get: {
"!type": "fn(options: ?, callback?: fn(res: +http.IncomingMessage)) -> +http.ClientRequest",
"!url": "https://nodejs.org/api/https.html#https_https_get_options_callback",
"!doc": "Like http.get() but for HTTPS."
},
Agent: "http.Agent",
globalAgent: "http.globalAgent"
},
cluster: {
"!proto": "events.EventEmitter.prototype",
settings: {
exec: "string",
args: "[string]",
silent: "bool",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_settings",
"!doc": "All settings set by the .setupMaster is stored in this settings object. This object is not supposed to be changed or set manually, by you."
},
Worker: {
"!type": "fn()",
prototype: {
"!proto": "events.EventEmitter.prototype",
id: {
"!type": "string",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_id",
"!doc": "Each new worker is given its own unique id, this id is stored in the id."
},
process: {
"!type": "+child_process.ChildProcess",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_process",
"!doc": "All workers are created using child_process.fork(), the returned object from this function is stored in process."
},
suicide: {
"!type": "bool",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_suicide",
"!doc": "This property is a boolean. It is set when a worker dies after calling .kill() or immediately after calling the .disconnect() method. Until then it is undefined."
},
send: {
"!type": "fn(message: ?, sendHandle?: ?)",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_send_message_sendhandle",
"!doc": "This function is equal to the send methods provided by child_process.fork(). In the master you should use this function to send a message to a specific worker. However in a worker you can also use process.send(message), since this is the same function."
},
destroy: "fn()",
disconnect: {
"!type": "fn()",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_disconnect",
"!doc": "When calling this function the worker will no longer accept new connections, but they will be handled by any other listening worker. Existing connection will be allowed to exit as usual. When no more connections exist, the IPC channel to the worker will close allowing it to die graceful. When the IPC channel is closed the disconnect event will emit, this is then followed by the exit event, there is emitted when the worker finally die."
},
kill: {
"!type": "fn(signal?: string)",
"!url": "https://nodejs.org/api/cluster.html#cluster_worker_kill_signal_sigterm",
"!doc": "This function will kill the worker, and inform the master to not spawn a new worker. The boolean suicide lets you distinguish between voluntary and accidental exit."
}
},
"!url": "https://nodejs.org/api/cluster.html#cluster_class_worker",
"!doc": "A Worker object contains all public information and method about a worker. In the master it can be obtained using cluster.workers. In a worker it can be obtained using cluster.worker."
},
isMaster: {
"!type": "bool",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_ismaster",
"!doc": "True if the process is a master. This is determined by the process.env.NODE_UNIQUE_ID. If process.env.NODE_UNIQUE_ID is undefined, then isMaster is true."
},
isWorker: {
"!type": "bool",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_isworker",
"!doc": "This boolean flag is true if the process is a worker forked from a master. If the process.env.NODE_UNIQUE_ID is set to a value, then isWorker is true."
},
setupMaster: {
"!type": "fn(settings?: cluster.settings)",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_setupmaster_settings",
"!doc": "setupMaster is used to change the default 'fork' behavior. The new settings are effective immediately and permanently, they cannot be changed later on."
},
fork: {
"!type": "fn(env?: ?) -> +cluster.Worker",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_fork_env",
"!doc": "Spawn a new worker process. This can only be called from the master process."
},
disconnect: {
"!type": "fn(callback?: fn())",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_disconnect_callback",
"!doc": "When calling this method, all workers will commit a graceful suicide. When they are disconnected all internal handlers will be closed, allowing the master process to die graceful if no other event is waiting."
},
worker: {
"!type": "+cluster.Worker",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_worker",
"!doc": "A reference to the current worker object. Not available in the master process."
},
workers: {
"!type": "[+cluster.Worker]",
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster_workers",
"!doc": "A hash that stores the active worker objects, keyed by id field. Makes it easy to loop through all the workers. It is only available in the master process."
},
"!url": "https://nodejs.org/api/cluster.html#cluster_cluster",
"!doc": "A single instance of Node runs in a single thread. To take advantage of multi-core systems the user will sometimes want to launch a cluster of Node processes to handle the load."
},
zlib: {
"!url": "https://nodejs.org/api/zlib.html",
"!doc": "This provides bindings to Gzip/Gunzip, Deflate/Inflate, and DeflateRaw/InflateRaw classes. Each class takes the same options, and is a readable/writable Stream.",
Zlib: {
"!type": "fn()",
prototype: {
"!proto": "stream.Duplex.prototype",
flush: {
"!type": "fn(callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_flush_callback",
"!doc": "Flush pending data. Don't call this frivolously, premature flushes negatively impact the effectiveness of the compression algorithm."
},
reset: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_reset",
"!doc": "Reset the compressor/decompressor to factory defaults. Only applicable to the inflate and deflate algorithms."
}
},
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_zlib",
"!doc": "Not exported by the zlib module. It is documented here because it is the base class of the compressor/decompressor classes."
},
deflate: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_deflate_buf_callback",
"!doc": "Compress a string with Deflate."
},
deflateRaw: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_deflateraw_buf_callback",
"!doc": "Compress a string with DeflateRaw."
},
gzip: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_gzip_buf_callback",
"!doc": "Compress a string with Gzip."
},
gunzip: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_gunzip_buf_callback",
"!doc": "Decompress a raw Buffer with Gunzip."
},
inflate: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_inflate_buf_callback",
"!doc": "Decompress a raw Buffer with Inflate."
},
inflateRaw: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_inflateraw_buf_callback",
"!doc": "Decompress a raw Buffer with InflateRaw."
},
unzip: {
"!type": "fn(buf: +Buffer, callback: fn())",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_unzip_buf_callback",
"!doc": "Decompress a raw Buffer with Unzip."
},
Gzip: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_gzip",
"!doc": "Compress data using gzip.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createGzip: {
"!type": "fn(options: ?) -> +zlib.Zlib",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_creategzip_options",
"!doc": "Returns a new Gzip object with an options."
},
Gunzip: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_gunzip",
"!doc": "Decompress a gzip stream.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createGunzip: {
"!type": "fn(options: ?) -> +zlib.Gunzip",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_creategunzip_options",
"!doc": "Returns a new Gunzip object with an options."
},
Deflate: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_deflate",
"!doc": "Compress data using deflate.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createDeflate: {
"!type": "fn(options: ?) -> +zlib.Deflate",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_createdeflate_options",
"!doc": "Returns a new Deflate object with an options."
},
Inflate: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_inflate",
"!doc": "Decompress a deflate stream.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createInflate: {
"!type": "fn(options: ?) -> +zlib.Inflate",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_createinflate_options",
"!doc": "Returns a new Inflate object with an options."
},
InflateRaw: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_inflateraw",
"!doc": "Decompress a raw deflate stream.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createInflateRaw: {
"!type": "fn(options: ?) -> +zlib.InflateRaw",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_createinflateraw_options",
"!doc": "Returns a new InflateRaw object with an options."
},
DeflateRaw: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_deflateraw",
"!doc": "Compress data using deflate, and do not append a zlib header.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createDeflateRaw: {
"!type": "fn(options: ?) -> +zlib.DeflateRaw",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_createdeflateraw_options",
"!doc": "Returns a new DeflateRaw object with an options."
},
Unzip: {
"!type": "fn()",
"!url": "https://nodejs.org/api/zlib.html#zlib_class_zlib_unzip",
"!doc": "Decompress either a Gzip- or Deflate-compressed stream by auto-detecting the header.",
prototype: {"!proto:": "zlib.Zlib.prototype"}
},
createUnzip: {
"!type": "fn(options: ?) -> +zlib.Unzip",
"!url": "https://nodejs.org/api/zlib.html#zlib_zlib_createunzip_options",
"!doc": "Returns a new Unzip object with an options."
},
Z_NO_FLUSH: "number",
Z_PARTIAL_FLUSH: "number",
Z_SYNC_FLUSH: "number",
Z_FULL_FLUSH: "number",
Z_FINISH: "number",
Z_BLOCK: "number",
Z_TREES: "number",
Z_OK: "number",
Z_STREAM_END: "number",
Z_NEED_DICT: "number",
Z_ERRNO: "number",
Z_STREAM_ERROR: "number",
Z_DATA_ERROR: "number",
Z_MEM_ERROR: "number",
Z_BUF_ERROR: "number",
Z_VERSION_ERROR: "number",
Z_NO_COMPRESSION: "number",
Z_BEST_SPEED: "number",
Z_BEST_COMPRESSION: "number",
Z_DEFAULT_COMPRESSION: "number",
Z_FILTERED: "number",
Z_HUFFMAN_ONLY: "number",
Z_RLE: "number",
Z_FIXED: "number",
Z_DEFAULT_STRATEGY: "number",
Z_BINARY: "number",
Z_TEXT: "number",
Z_ASCII: "number",
Z_UNKNOWN: "number",
Z_DEFLATED: "number",
Z_NULL: "number"
},
os: {
"!url": "https://nodejs.org/api/os.html",
"!doc": "Provides a few basic operating-system related utility functions.",
tmpdir: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_tmpdir",
"!doc": "Returns the operating system's default directory for temp files."
},
endianness: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_endianness",
"!doc": "Returns the endianness of the CPU. Possible values are \"BE\" or \"LE\"."
},
hostname: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_hostname",
"!doc": "Returns the hostname of the operating system."
},
type: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_type",
"!doc": "Returns the operating system name."
},
platform: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_platform",
"!doc": "Returns the operating system platform."
},
arch: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_arch",
"!doc": "Returns the operating system CPU architecture."
},
release: {
"!type": "fn() -> string",
"!url": "https://nodejs.org/api/os.html#os_os_release",
"!doc": "Returns the operating system release."
},
uptime: {
"!type": "fn() -> number",
"!url": "https://nodejs.org/api/os.html#os_os_uptime",
"!doc": "Returns the system uptime in seconds."
},
loadavg: {
"!type": "fn() -> [number]",
"!url": "https://nodejs.org/api/os.html#os_os_loadavg",
"!doc": "Returns an array containing the 1, 5, and 15 minute load averages."
},
totalmem: {
"!type": "fn() -> number",
"!url": "https://nodejs.org/api/os.html#os_os_totalmem",
"!doc": "Returns the total amount of system memory in bytes."
},
freemem: {
"!type": "fn() -> number",
"!url": "https://nodejs.org/api/os.html#os_os_freemem",
"!doc": "Returns the amount of free system memory in bytes."
},
cpus: {
"!type": "fn() -> [os.cpuSpec]",
"!url": "https://nodejs.org/api/os.html#os_os_cpus",
"!doc": "Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq)."
},
networkInterfaces: {
"!type": "fn() -> ?",
"!url": "https://nodejs.org/api/os.html#os_os_networkinterfaces",
"!doc": "Get a list of network interfaces."
},
EOL: {
"!type": "string",
"!url": "https://nodejs.org/api/os.html#os_os_eol",
"!doc": "A constant defining the appropriate End-of-line marker for the operating system."
}
},
punycode: {
"!url": "https://nodejs.org/api/punycode.html",
"!doc": "Punycode.js is bundled with Node.js v0.6.2+. Use require('punycode') to access it. (To use it with other Node.js versions, use npm to install the punycode module first.)",
decode: {
"!type": "fn(string: string) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_decode_string",
"!doc": "Converts a Punycode string of ASCII code points to a string of Unicode code points."
},
encode: {
"!type": "fn(string: string) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_encode_string",
"!doc": "Converts a string of Unicode code points to a Punycode string of ASCII code points."
},
toUnicode: {
"!type": "fn(domain: string) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_tounicode_domain",
"!doc": "Converts a Punycode string representing a domain name to Unicode. Only the Punycoded parts of the domain name will be converted, i.e. it doesn't matter if you call it on a string that has already been converted to Unicode."
},
toASCII: {
"!type": "fn(domain: string) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_toascii_domain",
"!doc": "Converts a Unicode string representing a domain name to Punycode. Only the non-ASCII parts of the domain name will be converted, i.e. it doesn't matter if you call it with a domain that's already in ASCII."
},
ucs2: {
decode: {
"!type": "fn(string: string) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_ucs2_decode_string",
"!doc": "Creates an array containing the decimal code points of each Unicode character in the string. While JavaScript uses UCS-2 internally, this function will convert a pair of surrogate halves (each of which UCS-2 exposes as separate characters) into a single code point, matching UTF-16."
},
encode: {
"!type": "fn(codePoints: [number]) -> string",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_ucs2_encode_codepoints",
"!doc": "Creates a string based on an array of decimal code points."
}
},
version: {
"!type": "?",
"!url": "https://nodejs.org/api/punycode.html#punycode_punycode_version",
"!doc": "A string representing the current Punycode.js version number."
}
},
repl: {
"!url": "https://nodejs.org/api/repl.html",
"!doc": "A Read-Eval-Print-Loop (REPL) is available both as a standalone program and easily includable in other programs. The REPL provides a way to interactively run JavaScript and see the results. It can be used for debugging, testing, or just trying things out.",
start: {
"!type": "fn(options: ?) -> +events.EventEmitter",
"!url": "https://nodejs.org/api/repl.html#repl_repl_start_options",
"!doc": "Returns and starts a REPLServer instance."
}
},
readline: {
"!url": "https://nodejs.org/api/readline.html",
"!doc": "Readline allows reading of a stream (such as process.stdin) on a line-by-line basis.",
createInterface: {
"!type": "fn(options: ?) -> +readline.Interface",
"!url": "https://nodejs.org/api/readline.html#readline_readline_createinterface_options",
"!doc": "Creates a readline Interface instance."
},
Interface: {
"!type": "fn()",
prototype: {
"!proto": "events.EventEmitter.prototype",
setPrompt: {
"!type": "fn(prompt: string, length: number)",
"!url": "https://nodejs.org/api/readline.html#readline_rl_setprompt_prompt_length",
"!doc": "Sets the prompt, for example when you run node on the command line, you see > , which is node's prompt."
},
prompt: {
"!type": "fn(preserveCursor?: bool)",
"!url": "https://nodejs.org/api/readline.html#readline_rl_prompt_preservecursor",
"!doc": "Readies readline for input from the user, putting the current setPrompt options on a new line, giving the user a new spot to write. Set preserveCursor to true to prevent the cursor placement being reset to 0."
},
question: {
"!type": "fn(query: string, callback: fn())",
"!url": "https://nodejs.org/api/readline.html#readline_rl_question_query_callback",
"!doc": "Prepends the prompt with query and invokes callback with the user's response. Displays the query to the user, and then invokes callback with the user's response after it has been typed."
},
pause: {
"!type": "fn()",
"!url": "https://nodejs.org/api/readline.html#readline_rl_pause",
"!doc": "Pauses the readline input stream, allowing it to be resumed later if needed."
},
resume: {
"!type": "fn()",
"!url": "https://nodejs.org/api/readline.html#readline_rl_resume",
"!doc": "Resumes the readline input stream."
},
close: {
"!type": "fn()",
"!url": "https://nodejs.org/api/readline.html#readline_rl_close",
"!doc": "Closes the Interface instance, relinquishing control on the input and output streams. The \"close\" event will also be emitted."
},
write: {
"!type": "fn(data: ?, key?: ?)",
"!url": "https://nodejs.org/api/readline.html#readline_rl_write_data_key",
"!doc": "Writes data to output stream. key is an object literal to represent a key sequence; available if the terminal is a TTY."
}
},
"!url": "https://nodejs.org/api/readline.html#readline_class_interface",
"!doc": "The class that represents a readline interface with an input and output stream."
}
},
vm: {
"!url": "https://nodejs.org/api/vm.html",
"!doc": "JavaScript code can be compiled and run immediately or compiled, saved, and run later.",
createContext: {
"!type": "fn(initSandbox?: ?) -> ?",
"!url": "https://nodejs.org/api/vm.html#vm_vm_createcontext_initsandbox",
"!doc": "vm.createContext creates a new context which is suitable for use as the 2nd argument of a subsequent call to vm.runInContext. A (V8) context comprises a global object together with a set of build-in objects and functions. The optional argument initSandbox will be shallow-copied to seed the initial contents of the global object used by the context."
},
Script: {
"!type": "fn()",
prototype: {
runInThisContext: {
"!type": "fn()",
"!url": "https://nodejs.org/api/vm.html#vm_script_runinthiscontext",
"!doc": "Similar to vm.runInThisContext but a method of a precompiled Script object. script.runInThisContext runs the code of script and returns the result. Running code does not have access to local scope, but does have access to the global object (v8: in actual context)."
},
runInNewContext: {
"!type": "fn(sandbox?: ?)",
"!url": "https://nodejs.org/api/vm.html#vm_script_runinnewcontext_sandbox",
"!doc": "Similar to vm.runInNewContext a method of a precompiled Script object. script.runInNewContext runs the code of script with sandbox as the global object and returns the result. Running code does not have access to local scope. sandbox is optional."
}
},
"!url": "https://nodejs.org/api/vm.html#vm_class_script",
"!doc": "A class for running scripts. Returned by vm.createScript."
},
runInThisContext: {
"!type": "fn(code: string, filename?: string)",
"!url": "https://nodejs.org/api/vm.html#vm_vm_runinthiscontext_code_filename",
"!doc": "vm.runInThisContext() compiles code, runs it and returns the result. Running code does not have access to local scope. filename is optional, it's used only in stack traces."
},
runInNewContext: {
"!type": "fn(code: string, sandbox?: ?, filename?: string)",
"!url": "https://nodejs.org/api/vm.html#vm_vm_runinnewcontext_code_sandbox_filename",
"!doc": "vm.runInNewContext compiles code, then runs it in sandbox and returns the result. Running code does not have access to local scope. The object sandbox will be used as the global object for code. sandbox and filename are optional, filename is only used in stack traces."
},
runInContext: {
"!type": "fn(code: string, context: ?, filename?: string)",
"!url": "https://nodejs.org/api/vm.html#vm_vm_runincontext_code_context_filename",
"!doc": "vm.runInContext compiles code, then runs it in context and returns the result. A (V8) context comprises a global object, together with a set of built-in objects and functions. Running code does not have access to local scope and the global object held within context will be used as the global object for code. filename is optional, it's used only in stack traces."
},
createScript: {
"!type": "fn(code: string, filename?: string) -> +vm.Script",
"!url": "https://nodejs.org/api/vm.html#vm_vm_createscript_code_filename",
"!doc": "createScript compiles code but does not run it. Instead, it returns a vm.Script object representing this compiled code. This script can be run later many times using methods below. The returned script is not bound to any global object. It is bound before each run, just for that run. filename is optional, it's only used in stack traces."
}
},
child_process: {
"!url": "https://nodejs.org/api/child_process.html",
"!doc": "Node provides a tri-directional popen(3) facility through the child_process module.",
ChildProcess: {
"!type": "fn()",
prototype: {
"!proto": "events.EventEmitter.prototype",
stdin: {
"!type": "+stream.Writable",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_stdin",
"!doc": "A Writable Stream that represents the child process's stdin. Closing this stream via end() often causes the child process to terminate."
},
stdout: {
"!type": "+stream.Readable",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_stdout",
"!doc": "A Readable Stream that represents the child process's stdout."
},
stderr: {
"!type": "+stream.Readable",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_stderr",
"!doc": "A Readable Stream that represents the child process's stderr."
},
pid: {
"!type": "number",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_pid",
"!doc": "The PID of the child process."
},
kill: {
"!type": "fn(signal?: string)",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_kill_signal",
"!doc": "Send a signal to the child process. If no argument is given, the process will be sent 'SIGTERM'."
},
send: {
"!type": "fn(message: ?, sendHandle?: ?)",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_send_message_sendhandle",
"!doc": "When using child_process.fork() you can write to the child using child.send(message, [sendHandle]) and messages are received by a 'message' event on the child."
},
disconnect: {
"!type": "fn()",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_disconnect",
"!doc": "To close the IPC connection between parent and child use the child.disconnect() method. This allows the child to exit gracefully since there is no IPC channel keeping it alive. When calling this method the disconnect event will be emitted in both parent and child, and the connected flag will be set to false. Please note that you can also call process.disconnect() in the child process."
}
},
"!url": "https://nodejs.org/api/child_process.html#child_process_class_childprocess",
"!doc": "ChildProcess is an EventEmitter."
},
spawn: {
"!type": "fn(command: string, args?: [string], options?: ?) -> +child_process.ChildProcess",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options",
"!doc": "Launches a new process with the given command, with command line arguments in args. If omitted, args defaults to an empty Array."
},
exec: {
"!type": "fn(command: string, callback: fn(error: ?, stdout: +Buffer, stderr: +Buffer)) -> +child_process.ChildProcess",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback",
"!doc": "Runs a command in a shell and buffers the output."
},
execFile: {
"!type": "fn(file: string, args: [string], options: ?, callback: fn(error: ?, stdout: +Buffer, stderr: +Buffer)) -> +child_process.ChildProcess",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_process_execfile_file_args_options_callback",
"!doc": "This is similar to child_process.exec() except it does not execute a subshell but rather the specified file directly. This makes it slightly leaner than child_process.exec. It has the same options."
},
fork: {
"!type": "fn(modulePath: string, args?: [string], options?: ?) -> +child_process.ChildProcess",
"!url": "https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options",
"!doc": "This is a special case of the spawn() functionality for spawning Node processes. In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in."
}