Mercurial > hg > nginx-site
annotate xml/en/docs/njs/reference.xml @ 2994:537b98ec3c83
Development guide: fixed example code.
The code produced compiler errors.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 17 Aug 2023 20:31:29 +0400 |
parents | 703d3450cd81 |
children | adecad3d7039 |
rev | line source |
---|---|
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
1 <?xml version="1.0"?> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
2 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
3 <!-- |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
4 Copyright (C) Nginx, Inc. |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5 --> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
8 |
2246
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
9 <article name="Reference" |
32ba43abf9cd
Renamed njs API, njs Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2245
diff
changeset
|
10 link="/en/docs/njs/reference.html" |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
11 lang="en" |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
12 rev="111"> |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
13 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
14 <section id="summary"> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
15 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
16 <para> |
2244
467aef18bf12
Renamed the "About njs" page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2237
diff
changeset
|
17 <link doc="index.xml">njs</link> provides objects, methods and properties |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
18 for extending nginx functionality. |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
19 </para> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
20 |
2569
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
21 <para> |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
22 This reference contains only njs specific properties, methods and modules |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
23 not compliant with ECMAScript. |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
24 Definitions of njs properties and methods compliant with ECMAScript |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
25 can be found in |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
26 <link url="http://www.ecma-international.org/ecma-262/">ECMAScript |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
27 specification</link>. |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
28 List of all njs properties and methods can be found in |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
29 <link doc="compatibility.xml">Compatibility</link>. |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
30 </para> |
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
31 |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
32 </section> |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
33 |
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
34 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
35 <section id="http_stream" name="nginx objects"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
36 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
37 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
38 <section id="http" name="HTTP Request"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
39 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
40 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
41 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
42 <tr><td><link id="r_args"><literal>r.args{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
43 <tr><td><link id="r_done"><literal>r.done()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
44 <tr><td><link id="r_error"><literal>r.error()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
45 <tr><td><link id="r_finish"><literal>r.finish()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
46 <tr><td><link id="r_headers_in"><literal>r.headersIn{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
47 <tr><td><link id="r_headers_out"><literal>r.headersOut{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
48 <tr><td><link id="r_http_version"><literal>r.httpVersion</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
49 <tr><td><link id="r_internal"><literal>r.internal</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
50 <tr><td><link id="r_internal_redirect"><literal>r.internalRedirect()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
51 <tr><td><link id="r_log"><literal>r.log()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
52 <tr><td><link id="r_method"><literal>r.method</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
53 <tr><td><link id="r_parent"><literal>r.parent</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
54 <tr><td><link id="r_remote_address"><literal>r.remoteAddress</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
55 <tr><td><link id="r_request_body"><literal>r.requestBody</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
56 <tr><td><link id="r_request_buffer"><literal>r.requestBuffer</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
57 <tr><td><link id="r_request_text"><literal>r.requestText</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
58 <tr><td><link id="r_raw_headers_in"><literal>r.rawHeadersIn{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
59 <tr><td><link id="r_raw_headers_out"><literal>r.rawHeadersOut{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
60 <tr><td><link id="r_response_body"><literal>r.responseBody</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
61 <tr><td><link id="r_response_buffer"><literal>r.responseBuffer</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
62 <tr><td><link id="r_response_text"><literal>r.responseText</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
63 <tr><td><link id="r_return"><literal>r.return()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
64 <tr><td><link id="r_send"><literal>r.send()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
65 <tr><td><link id="r_sendbuffer"><literal>r.sendBuffer()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
66 <tr><td><link id="r_send_header"><literal>r.sendHeader()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
67 <tr><td><link id="r_set_return_value"><literal>r.setReturnValue()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
68 <tr><td><link id="r_status"><literal>r.status</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
69 <tr><td><link id="r_subrequest"><literal>r.subrequest()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
70 <tr><td><link id="r_uri"><literal>r.uri</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
71 <tr><td><link id="r_raw_variables"><literal>r.rawVariables{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
72 <tr><td><link id="r_variables"><literal>r.variables{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
73 <tr><td><link id="r_warn"><literal>r.warn()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
74 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
75 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
76 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
77 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
78 The HTTP request object is available only in the |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
79 <link doc="../http/ngx_http_js_module.xml">ngx_http_js_module</link> module. |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
80 All string properties of the object are |
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
81 <link id="string">byte strings</link>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
82 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
83 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
84 |
2353 | 85 <tag-name id="r_args"><literal>r.args{}</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
86 <tag-desc> |
2872
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
87 request arguments object, read-only. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
88 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
89 The query string is returned as an object. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
90 Since <link doc="changes.xml" id="njs0.7.6">0.7.6</link>, |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
91 duplicate keys are returned as an array, |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
92 keys are case-sensitive, both keys and values are percent-decoded. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
93 </para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
94 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
95 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
96 For example, the query string |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
97 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
98 'a=1&b=%32&A=3&b=4&B=two%20words' |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
99 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
100 is converted to <literal>r.args</literal> as: |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
101 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
102 {a: "1", b: ["2", "4"], A: "3", B: "two words"} |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
103 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
104 More advanced parsing scenarios can be achieved with the |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
105 <link id="querystring">Query String</link> module |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
106 and with the |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
107 <link doc="../http/ngx_http_core_module.xml" id="var_args"><literal>$args</literal></link> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
108 variable, for example: |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
109 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
110 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
111 import qs from 'querystring'; |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
112 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
113 function args(r) { |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
114 return qs.parse(r.variables.args); |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
115 } |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
116 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
117 The argument object |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
118 is evaluated at the first access to <literal>r.args</literal>. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
119 If only a single argument is needed, for example <literal>foo</literal>, |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
120 <link doc="../varindex.xml">nginx variables</link> can be used: |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
121 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
122 r.variables.arg_foo |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
123 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
124 Here, <link id="r_variables">nginx variables object</link> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
125 returns the first value for a given key, |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
126 case-insensitive, without percent-decoding. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
127 </para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
128 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
129 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
130 To convert <literal>r.args</literal> back to a string, |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
131 the Query String |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
132 <link id="querystring_stringify"><literal>stringify</literal></link> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
133 method can be used. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
134 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
135 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
136 |
2663
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
137 <tag-name id="r_done"><literal>r.done()</literal></tag-name> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
138 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
139 after calling this function, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
140 next data chunks will be passed to client without calling |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
141 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
142 (<link doc="changes.xml" id="njs0.5.2">0.5.2</link>). |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
143 May be called only from the |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
144 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/> function |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
145 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
146 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
147 <tag-name id="r_error"><literal>r.error(<value>string</value>)</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
148 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
149 writes a <literal>string</literal> to the error log |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
150 on the <literal>error</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
151 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
152 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
153 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
154 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
155 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
156 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
157 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
158 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
159 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
160 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
161 <tag-name id="r_finish"><literal>r.finish()</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
162 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
163 finishes sending a response to the client |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
164 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
165 |
2353 | 166 <tag-name id="r_headers_in"><literal>r.headersIn{}</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
167 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
168 incoming headers object, read-only. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
169 <para> |
2543
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
170 The <literal>Foo</literal> request header |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
171 can be accessed with the syntax: |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
172 <literal>headersIn.foo</literal> or <literal>headersIn['Foo']</literal>. |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
173 </para> |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
174 |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
175 <para> |
2735
ff357b676c2e
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2716
diff
changeset
|
176 The |
2543
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
177 <header>Authorization</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
178 <header>Content-Length</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
179 <header>Content-Range</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
180 <header>Content-Type</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
181 <header>ETag</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
182 <header>Expect</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
183 <header>From</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
184 <header>Host</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
185 <header>If-Match</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
186 <header>If-Modified-Since</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
187 <header>If-None-Match</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
188 <header>If-Range</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
189 <header>If-Unmodified-Since</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
190 <header>Max-Forwards</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
191 <header>Proxy-Authorization</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
192 <header>Referer</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
193 <header>Transfer-Encoding</header>, and |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
194 <header>User-Agent</header> |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
195 request headers can have only one field value |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
196 (<link doc="changes.xml" id="njs0.4.1">0.4.1</link>). |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
197 Duplicate field values in <header>Cookie</header> headers |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
198 are separated by semicolon (<literal>;</literal>). |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
199 Duplicate field values in all other request headers are separated by commas. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
200 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
201 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
202 |
2331 | 203 <tag-name id="r_headers_out"><literal>r.headersOut{}</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
204 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
205 outgoing headers object, writable. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
206 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
207 The <header>Foo</header> response header |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
208 can be accessed with the syntax: |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
209 <literal>headersOut.foo</literal> or <literal>headersOut['Foo']</literal>. |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
210 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
211 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
212 <para> |
2894
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
213 Outgoing headers should be set before a response header is sent to a client, |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
214 otherwise header update will be ignored. |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
215 This means that <literal>r.headersOut{}</literal> is effectively writable in: |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
216 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
217 <list type="bullet"> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
218 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
219 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
220 the <link doc="../http/ngx_http_js_module.xml" id="js_content"/> handler before |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
221 <link id="r_send_header"><literal>r.sendHeader()</literal></link> or |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
222 <link id="r_return"><literal>r.return()</literal></link> are called |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
223 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
224 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
225 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
226 the <link doc="../http/ngx_http_js_module.xml" id="js_header_filter"/> handler |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
227 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
228 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
229 </list> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
230 </para> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
231 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
232 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
233 Field values of multi-value response headers |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
234 (<link doc="changes.xml" id="njs0.4.0">0.4.0</link>) |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
235 can be set with the syntax: |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
236 <example> |
2544
33347df1da9c
Relocated sentence in r.headers.Out, added dot, corrected quotes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2543
diff
changeset
|
237 r.headersOut['Foo'] = ['a', 'b'] |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
238 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
239 where the output will be: |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
240 <example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
241 Foo: a |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
242 Foo: b |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
243 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
244 All previous field values of the <header>Foo</header> response header |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
245 will be deleted. |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
246 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
247 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
248 <para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
249 For standard response headers |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
250 that accept only a single field value such as |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
251 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
252 only the last element of the array will take effect. |
2544
33347df1da9c
Relocated sentence in r.headers.Out, added dot, corrected quotes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2543
diff
changeset
|
253 Field values of the <header>Set-Cookie</header> response header |
33347df1da9c
Relocated sentence in r.headers.Out, added dot, corrected quotes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2543
diff
changeset
|
254 are always returned as an array. |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
255 Duplicate field values in |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
256 <header>Age</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
257 <header>Content-Encoding</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
258 <header>Content-Length</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
259 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
260 <header>ETag</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
261 <header>Expires</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
262 <header>Last-Modified</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
263 <header>Location</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
264 <header>Retry-After</header> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
265 response headers are ignored. |
2537
d6bbfd20c82f
Rephrased a sentence in r.headersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2532
diff
changeset
|
266 Duplicate field values in all other response headers |
d6bbfd20c82f
Rephrased a sentence in r.headersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2532
diff
changeset
|
267 are separated by commas. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
268 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
269 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
270 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
271 <tag-name id="r_http_version"><literal>r.httpVersion</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
272 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
273 HTTP version, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
274 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
275 |
2888
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
276 <tag-name id="r_internal"><literal>r.internal</literal></tag-name> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
277 <tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
278 boolean value, true for |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
279 <link doc="../http/ngx_http_core_module.xml" id="internal">internal</link> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
280 locations |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
281 </tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
282 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
283 <tag-name id="r_internal_redirect"><literal>r.internalRedirect(<value>uri</value>)</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
284 <tag-desc> |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
285 performs an |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
286 <link doc="../dev/development_guide.xml" id="http_request_redirection">internal |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
287 redirect</link> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
288 to the specified <literal>uri</literal>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
289 If the uri starts with the “<literal>@</literal>” prefix, |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
290 it is considered a named location. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
291 Redirected requests become internal and can access the |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
292 <link doc="../http/ngx_http_core_module.xml" id="internal">internal</link> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
293 locations. |
2525
6ce28e0beec0
Updated description of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2509
diff
changeset
|
294 The actual redirect happens after the handler execution is completed. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
295 <para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
296 <note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
297 After redirect, |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
298 a new njs VM is started in the target location, |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
299 the VM in the original location is stopped. |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
300 Values of <link doc="../varindex.xml">nginx variables</link> are kept |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
301 and can be used to pass information to the target location. |
2716
f82f16e327f2
Added info about js_var to r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
302 Since <link doc="changes.xml" id="njs0.5.3">0.5.3</link>, |
f82f16e327f2
Added info about js_var to r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
303 the variable declared with the <literal>js_var</literal> directive for |
f82f16e327f2
Added info about js_var to r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
304 <link doc="../http/ngx_http_js_module.xml" id="js_var">http</link> or |
f82f16e327f2
Added info about js_var to r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
305 <link doc="../stream/ngx_stream_js_module.xml" id="js_var">stream</link> |
f82f16e327f2
Added info about js_var to r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2693
diff
changeset
|
306 can be used. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
307 </note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
308 </para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
309 |
2848
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
310 <para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
311 <note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
312 Since <link doc="changes.xml" id="njs0.7.4">0.7.4</link>, |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
313 the method accepts escaped URIs. |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
314 </note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
315 </para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
316 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
317 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
318 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
319 <tag-name id="r_log"><literal>r.log(<value>string</value>)</literal></tag-name> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
320 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
321 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
322 on the <literal>info</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
323 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
324 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
325 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
326 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
327 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
328 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
329 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
330 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
331 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
332 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
333 <tag-name id="r_method"><literal>r.method</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
334 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
335 HTTP method, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
336 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
337 |
2497
805c4b84cc61
Added missing feature and links to njs-0.3.8 Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2496
diff
changeset
|
338 <tag-name id="r_parent"><literal>r.parent</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
339 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
340 references the parent request object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
341 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
342 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
343 <tag-name id="r_remote_address"><literal>r.remoteAddress</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
344 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
345 client address, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
346 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
347 |
2628 | 348 <tag-name id="r_request_body"><literal>r.requestBody</literal></tag-name> |
349 <tag-desc> | |
2981
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
350 the property was made obsolete in |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
351 <link doc="changes.xml" id="njs0.5.0">0.5.0</link> |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
352 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
353 The <link id="r_request_buffer"><literal>r.requestBuffer</literal></link> or |
2628 | 354 <link id="r_request_text"><literal>r.requestText</literal></link> property |
355 should be used instead. | |
356 </tag-desc> | |
357 | |
358 <tag-name id="r_request_buffer"><literal>r.requestBuffer</literal></tag-name> | |
359 <tag-desc> | |
360 client request body if it has not been written to a temporary file | |
361 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
362 To ensure that the client request body is in memory, | |
363 its size should be limited by | |
364 <link doc="../http/ngx_http_core_module.xml" id="client_max_body_size"/>, | |
365 and a sufficient buffer size should be set using | |
366 <link doc="../http/ngx_http_core_module.xml" id="client_body_buffer_size"/>. | |
367 The property is available only in the | |
368 <link doc="../http/ngx_http_js_module.xml" id="js_content"/> directive. | |
369 </tag-desc> | |
370 | |
371 <tag-name id="r_request_text"><literal>r.requestText</literal></tag-name> | |
372 <tag-desc> | |
373 the same as <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, | |
374 but returns a <literal>string</literal>. | |
375 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
376 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 377 </tag-desc> |
378 | |
2546
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
379 <tag-name id="r_raw_headers_in"><literal>r.rawHeadersIn{}</literal></tag-name> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
380 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
381 returns an array of key-value pairs |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
382 exactly as they were received from the client |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
383 (<link doc="changes.xml" id="njs0.4.1">0.4.1</link>). |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
384 <para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
385 For example, with the following request headers: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
386 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
387 Host: localhost |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
388 Foo: bar |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
389 foo: bar2 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
390 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
391 the output of <literal>r.rawHeadersIn</literal> will be: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
392 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
393 [ |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
394 ['Host', 'localhost'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
395 ['Foo', 'bar'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
396 ['foo', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
397 ] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
398 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
399 All <literal>foo</literal> headers |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
400 can be collected with the syntax: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
401 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
402 r.rawHeadersIn.filter(v=>v[0].toLowerCase() == 'foo').map(v=>v[1]) |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
403 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
404 the output will be: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
405 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
406 ['bar', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
407 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
408 Header field names are not converted to lower case, |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
409 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
410 </para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
411 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
412 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
413 <tag-name id="r_raw_headers_out"><literal>r.rawHeadersOut{}</literal></tag-name> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
414 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
415 returns an array of key-value pairs of response headers |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
416 (<link doc="changes.xml" id="njs0.4.1">0.4.1</link>). |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
417 Header field names are not converted to lower case, |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
418 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
419 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
420 |
2628 | 421 <tag-name id="r_response_body"><literal>r.responseBody</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
422 <tag-desc> |
2981
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
423 the property was made obsolete in |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
424 <link doc="changes.xml" id="njs0.5.0">0.5.0</link> |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
425 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
426 The <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> |
2628 | 427 or |
428 the <link id="r_response_text"><literal>r.responseText</literal></link> | |
429 property | |
430 should be used instead. | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
431 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
432 |
2628 | 433 <tag-name id="r_response_buffer"><literal>r.responseBuffer</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
434 <tag-desc> |
2628 | 435 holds the <link id="r_subrequest">subrequest</link> response body, |
436 read-only | |
437 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
438 The size of <literal>r.responseBuffer</literal> is limited by the | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
439 <link doc="../http/ngx_http_core_module.xml" id="subrequest_output_buffer_size"/> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
440 directive. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
441 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
442 |
2628 | 443 <tag-name id="r_response_text"><literal>r.responseText</literal></tag-name> |
444 <tag-desc> | |
445 the same as <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> | |
446 but returns a string | |
447 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
448 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
449 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 450 </tag-desc> |
451 | |
452 <tag-name id="r_return"><literal>r.return(status[, | |
453 string | Buffer])</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
454 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
455 sends the entire response |
2628 | 456 with the specified <literal>status</literal> to the client. |
457 The response can be a string or Buffer | |
458 (<link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
459 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
460 It is possible to specify either a redirect URL |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
461 (for codes 301, 302, 303, 307, and 308) |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
462 or the response body text (for other codes) as the second argument |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
463 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
464 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
465 |
2628 | 466 <tag-name id="r_send"><literal>r.send(string |
467 | Buffer)</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
468 <tag-desc> |
2628 | 469 sends a part of the response body to the client. |
470 The data sent can be a string or Buffer | |
471 (<link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
472 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
473 |
2663
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
474 <tag-name id="r_sendbuffer"><literal>r.sendBuffer(<value>data</value>[, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
475 <value>options</value>])</literal></tag-name> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
476 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
477 adds data to the chain of data chunks to be forwarded to the next body filter |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
478 (<link doc="changes.xml" id="njs0.5.2">0.5.2</link>). |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
479 The actual forwarding happens later, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
480 when the all the data chunks of the current chain are processed. |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
481 <para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
482 The data can be a string or Buffer. |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
483 The <literal>options</literal> is an object used |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
484 to override nginx buffer flags derived from an incoming data chunk buffer. |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
485 The flags can be overridden with the following flags: |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
486 <list type="tag"> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
487 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
488 <tag-name><literal>last</literal></tag-name> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
489 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
490 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
491 true if the buffer is the last buffer |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
492 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
493 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
494 <tag-name><literal>flush</literal></tag-name> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
495 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
496 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
497 true if the buffer should have the <literal>flush</literal> flag |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
498 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
499 </list> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
500 </para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
501 The method may be called only from the |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
502 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/> function. |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
503 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
504 |
2571
3e47eecce384
Added id to r.sendHeader in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2570
diff
changeset
|
505 <tag-name id="r_send_header"><literal>r.sendHeader()</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
506 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
507 sends the HTTP headers to the client |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
508 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
509 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
510 <tag-name id="r_set_return_value"><literal>r.setReturnValue(<value>value</value>)</literal></tag-name> |
2777
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
511 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
512 sets the return value of the |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
513 <link doc="../http/ngx_http_js_module.xml" id="js_set"/> handler |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
514 (<link doc="changes.xml" id="njs0.7.0">0.7.0</link>). |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
515 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
516 this method should be used when the handler is JS async function. |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
517 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
518 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
519 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
520 const digest = await crypto.subtle.digest('SHA-256', r.headersIn.host); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
521 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
522 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
523 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
524 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
525 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
526 <tag-name id="r_status"><literal>r.status</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
527 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
528 status, writable |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
529 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
530 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
531 <tag-name id="r_subrequest"><literal>r.subrequest(<value>uri</value>[, |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
532 <value>options</value>[, <value>callback</value>]])</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
533 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
534 creates a subrequest with the given <literal>uri</literal> and |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
535 <literal>options</literal>, and installs |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
536 an optional completion <literal>callback</literal>. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
537 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
538 <para> |
2340
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
539 A |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
540 <link doc="../dev/development_guide.xml.xml" id="http_subrequests">subrequest</link> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
541 shares its input headers with the client request. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
542 To send headers different from original headers to a proxied server, the |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
543 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_set_header"/> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
544 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
545 To send a completely new set of headers to a proxied server, the |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
546 <link doc="../http/ngx_http_proxy_module.xml" id="proxy_pass_request_headers"/> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
547 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
548 </para> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
549 |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
550 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
551 If <literal>options</literal> is a string, then it |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
552 holds the subrequest arguments string. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
553 Otherwise, <literal>options</literal> is expected to be |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
554 an object with the following keys: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
555 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
556 <tag-name><literal>args</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
557 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
558 arguments string, by default an empty string is used |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
559 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
560 <tag-name><literal>body</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
561 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
562 request body, |
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
563 by default the request body of the parent request object is used |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
564 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
565 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
566 <tag-name><literal>method</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
567 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
568 HTTP method, by default the <literal>GET</literal> method is used |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
569 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
570 |
2507 | 571 <tag-name><literal>detached</literal></tag-name> |
572 <tag-desc> | |
573 boolean flag (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), | |
574 if <literal>true</literal>, the created subrequest is a detached subrequest. | |
575 Responses to detached subrequests are ignored. | |
576 Unlike ordinary subrequests, a detached subrequest | |
577 can be created inside a variable handler. | |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
578 The <literal>detached</literal> flag and callback argument |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
579 are mutually exclusive. |
2507 | 580 </tag-desc> |
581 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
582 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
583 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
584 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
585 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
586 The completion <literal>callback</literal> receives |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
587 a subrequest response object with methods and properties |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
588 identical to the parent request object. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
589 </para> |
2484
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
590 |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
591 <para> |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
592 Since <link doc="changes.xml" id="njs0.3.8">0.3.8</link>, |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
593 if a <literal>callback</literal> is not provided, |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
594 the <literal>Promise</literal> object |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
595 that resolves to the subrequest response object is returned. |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
596 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
597 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
598 |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
599 <tag-name id="r_uri"><literal>r.uri</literal></tag-name> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
600 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
601 current <link doc="../http/ngx_http_core_module.xml" id="var_uri">URI</link> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
602 in request, |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
603 <link doc="../http/ngx_http_core_module.xml" id="location">normalized</link>, |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
604 read-only |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
605 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
606 |
2628 | 607 <tag-name id="r_raw_variables"><literal>r.rawVariables{}</literal></tag-name> |
608 <tag-desc> | |
609 nginx <link id="r_variables">variables</link> as Buffers, | |
610 writable | |
611 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
612 </tag-desc> | |
613 | |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
614 <tag-name id="r_variables"><literal>r.variables{}</literal></tag-name> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
615 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
616 <link doc="../varindex.xml">nginx variables</link> object, writable |
2689
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
617 (since <link doc="changes.xml" id="njs0.2.8">0.2.8</link>). |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
618 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
619 <para> |
2926
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
620 For example, to get the <literal>$foo</literal> variable, |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
621 one of the following syntax can be used: |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
622 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
623 r.variables['foo'] |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
624 r.variables.foo |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
625 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
626 nginx treats variables referenced in <literal>nginx.conf</literal> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
627 and unreferenced variables differently. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
628 When a variable is referenced, it may be cacheable, |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
629 but when it is unreferenced it is always uncacheable. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
630 For example, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
631 <link doc="../http/ngx_http_core_module.xml" id="var_request_id">$request_id</link> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
632 variable is only accessed from njs, |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
633 it has a new value every time it is evaluated. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
634 But, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
635 <link doc="../http/ngx_http_core_module.xml" id="var_request_id">$request_id</link> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
636 is referenced, for example: |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
637 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
638 proxy_set_header X-Request-Id $request_id; |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
639 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
640 the <literal>r.variables.request_id</literal> returns the same value every time. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
641 </para> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
642 |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
643 <para> |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
644 A variable is writable if: |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
645 <list type="bullet"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
646 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
647 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
648 it was created using the <literal>js_var</literal> directive for |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
649 <link doc="../http/ngx_http_js_module.xml" id="js_var">http</link> or |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
650 <link doc="../stream/ngx_stream_js_module.xml" id="js_var">stream</link> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
651 (since <link doc="changes.xml" id="njs0.5.3">0.5.3</link>) |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
652 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
653 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
654 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
655 it is referenced in nginx configuration file |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
656 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
657 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
658 </list> |
2689
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
659 Even so, some embedded variables still cannot be assigned a value (for example, |
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
660 <link doc="../http/ngx_http_core_module.xml" id="var_http_"><literal>$http_</literal></link>). |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
661 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
662 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
663 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
664 <tag-name id="r_warn"><literal>r.warn(<value>string</value>)</literal></tag-name> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
665 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
666 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
667 on the <literal>warning</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
668 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
669 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
670 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
671 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
672 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
673 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
674 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
675 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
676 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
677 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
678 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
679 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
680 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
681 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
682 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
683 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
684 <section id="stream" name="Stream Session"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
685 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
686 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
687 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
688 <tr><td><link id="s_allow"><literal>s.allow()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
689 <tr><td><link id="s_decline"><literal>s.decline()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
690 <tr><td><link id="s_deny"><literal>s.deny()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
691 <tr><td><link id="s_done"><literal>s.done()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
692 <tr><td><link id="s_error"><literal>s.error()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
693 <tr><td><link id="s_log"><literal>s.log()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
694 <tr><td><link id="s_off"><literal>s.off()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
695 <tr><td><link id="s_on"><literal>s.on()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
696 <tr><td><link id="s_remote_address"><literal>s.remoteAddress</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
697 <tr><td><link id="s_raw_variables"><literal>s.rawVariables{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
698 <tr><td><link id="s_send"><literal>s.send()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
699 <tr><td><link id="s_send_downstream"><literal>s.sendDownstream()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
700 <tr><td><link id="s_send_upstream"><literal>s.sendUpstream()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
701 <tr><td><link id="s_status"><literal>s.status</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
702 <tr><td><link id="s_set_return_value"><literal>s.setReturnValue()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
703 <tr><td><link id="s_variables"><literal>s.variables{}</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
704 <tr><td><link id="s_warn"><literal>s.warn()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
705 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
706 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
707 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
708 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
709 The stream session object is available only in the |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
710 <link doc="../stream/ngx_stream_js_module.xml">ngx_stream_js_module</link> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
711 module. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
712 All string properties of the object are <link id="string">byte strings</link>. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
713 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
714 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
715 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
716 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
717 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
718 <tag-name id="s_allow"><literal>s.allow()</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
719 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
720 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
721 <link id="s_done"><literal>s.done(0)</literal></link> |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
722 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
723 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
724 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
725 <tag-name id="s_decline"><literal>s.decline()</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
726 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
727 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
728 <link id="s_done"><literal>s.done(-5)</literal></link> |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
729 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
730 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
731 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
732 <tag-name id="s_deny"><literal>s.deny()</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
733 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
734 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
735 <link id="s_done"><literal>s.done(403)</literal></link> |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
736 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
737 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
738 |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
739 <tag-name id="s_done"><literal>s.done([<value>code</value>]</literal>)</tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
740 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
741 sets an exit <literal>code</literal> for the current |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
742 <link doc="../stream/stream_processing.xml">phase</link> handler |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
743 to a code value, by default <literal>0</literal>. |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
744 The actual finalization happens when the js handler is completed |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
745 and all pending events, for example, from |
2679
8f3e9ff2785f
Corrected syntax of njs.on() and ngx.fetch() in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2670
diff
changeset
|
746 <link id="ngx_fetch"><literal>ngx.fetch()</literal></link> or |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
747 <link id="settimeout"><literal>setTimeout()</literal></link>, |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
748 are processed |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
749 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>). |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
750 <para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
751 Possible code values: |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
752 <list type="bullet"> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
753 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
754 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
755 <literal>0</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
756 successful finalization, passing control to the next phase |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
757 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
758 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
759 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
760 <literal>-5</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
761 undecided, passing control to the next handler of the current phase (if any) |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
762 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
763 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
764 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
765 <literal>403</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
766 access is forbidden |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
767 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
768 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
769 </list> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
770 </para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
771 May be called only from a phase handler function: |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
772 <link doc="../stream/ngx_stream_js_module.xml" id="js_access"><literal>js_access</literal></link> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
773 or |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
774 <link doc="../stream/ngx_stream_js_module.xml" id="js_preread"><literal>js_preread</literal></link>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
775 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
776 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
777 <tag-name id="s_error"><literal>s.error(<value>string</value>)</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
778 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
779 writes a sent <literal>string</literal> to the error log |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
780 on the <literal>error</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
781 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
782 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
783 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
784 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
785 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
786 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
787 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
788 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
789 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
790 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
791 <tag-name id="s_log"><literal>s.log(<value>string</value>)</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
792 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
793 writes a sent <value>string</value> to the error log |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
794 on the <literal>info</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
795 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
796 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
797 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
798 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
799 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
800 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
801 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
802 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
803 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
804 |
2881
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
805 <tag-name id="s_off"><literal>s.off(<value>eventName</value>)</literal></tag-name> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
806 <tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
807 unregisters the callback set by the <link id="s_on">s.on()</link> method |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
808 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>) |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
809 </tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
810 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
811 <tag-name id="s_on"><literal>s.on(<value>event</value>, |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
812 <value>callback</value>)</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
813 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
814 registers a <literal>callback</literal> |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
815 for the specified <literal>event</literal> |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
816 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>). |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
817 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
818 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
819 An <literal>event</literal> may be one of the following strings: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
820 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
821 <tag-name><literal>upload</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
822 <tag-desc> |
2628 | 823 new data (string) from a client |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
824 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
825 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
826 <tag-name><literal>download</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
827 <tag-desc> |
2628 | 828 new data (string) to a client |
829 </tag-desc> | |
830 | |
831 <tag-name><literal>upstream</literal></tag-name> | |
832 <tag-desc> | |
833 new data (Buffer) from a client | |
834 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
835 </tag-desc> | |
836 | |
837 <tag-name><literal>downstream</literal></tag-name> | |
838 <tag-desc> | |
839 new data (Buffer) to a client | |
840 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
841 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
842 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
843 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
844 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
845 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
846 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
847 The completion callback has the following prototype: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
848 <literal>callback(data, flags)</literal>, where |
2628 | 849 <literal>data</literal> is string or Buffer (depending on the event type) |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
850 <literal>flags</literal> is an object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
851 with the following properties: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
852 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
853 <tag-name id="s_on_callback_last"><literal>last</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
854 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
855 a boolean value, true if data is a last buffer. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
856 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
857 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
858 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
859 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
860 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
861 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
862 <tag-name id="s_remote_address"><literal>s.remoteAddress</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
863 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
864 client address, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
865 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
866 |
2628 | 867 <tag-name id="s_raw_variables"><literal>s.rawVariables</literal></tag-name> |
868 <tag-desc> | |
869 nginx <link id="s_variables">variables</link> as Buffers, | |
870 writable | |
871 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
872 </tag-desc> | |
873 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
874 <tag-name id="s_send"><literal>s.send(<value>data</value>[, |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
875 <value>options</value>])</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
876 <tag-desc> |
2667
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
877 adds data to the chain of data chunks that will be forwarded in |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
878 the forward direction: |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
879 in download callback to a client; in upload to an upstream server |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
880 (<link doc="changes.xml" id="njs0.2.4">0.2.4</link>). |
2667
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
881 The actual forwarding happens later, |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
882 when the all the data chunks of the current chain are processed. |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
883 <para> |
2628 | 884 The data can be a string or Buffer |
885 (<link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
886 The <literal>options</literal> is an object used |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
887 to override nginx buffer flags derived from an incoming data chunk buffer. |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
888 The flags can be overridden with the following flags: |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
889 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
890 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
891 <tag-name><literal>last</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
892 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
893 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
894 true if the buffer is the last buffer |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
895 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
896 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
897 <tag-name><literal>flush</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
898 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
899 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
900 true if the buffer should have the <literal>flush</literal> flag |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
901 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
902 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
903 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
904 The method can be called multiple times per callback invocation. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
905 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
906 |
2902
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
907 <tag-name id="s_send_downstream"><literal>s.sendDownstream()</literal></tag-name> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
908 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
909 is identical to <link id="s_send">s.send()</link>, |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
910 except for it always sends data to a client |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
911 (since <link doc="changes.xml" id="njs0.7.8">0.7.8</link>). |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
912 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
913 |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
914 <tag-name id="s_send_upstream"><literal>s.sendUpstream()</literal></tag-name> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
915 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
916 is identical to <link id="s_send">s.send()</link>, |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
917 except for it always sends data from a client |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
918 (since <link doc="changes.xml" id="njs0.7.8">0.7.8</link>). |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
919 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
920 |
2665
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
921 <tag-name id="s_status"><literal>s.status</literal></tag-name> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
922 <tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
923 session status code, an alias to the |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
924 <link doc="../stream/ngx_stream_core_module.xml" id="var_status"><literal>$status</literal></link> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
925 variable, |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
926 read only |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
927 (since <link doc="changes.xml" id="njs0.5.2">0.5.2</link>) |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
928 </tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
929 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
930 <tag-name id="s_set_return_value"><literal>s.setReturnValue(<value>value</value>)</literal></tag-name> |
2777
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
931 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
932 sets the return value of the |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
933 <link doc="../stream/ngx_stream_js_module.xml" id="js_set"/> handler |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
934 (<link doc="changes.xml" id="njs0.7.0">0.7.0</link>). |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
935 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
936 this method should be used when the handler is JS async function. |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
937 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
938 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
939 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
940 const digest = await crypto.subtle.digest('SHA-256', r.headersIn.host); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
941 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
942 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
943 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
944 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
945 |
2338
39ac205f90b7
Documented that r.variables{} and s.variables{} are writable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2337
diff
changeset
|
946 <tag-name id="s_variables"><literal>s.variables{}</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
947 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
948 <link doc="../varindex.xml">nginx variables</link> object, writable |
2689
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
949 (since <link doc="changes.xml" id="njs0.2.8">0.2.8</link>). |
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
950 A variable can be writable only |
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
951 if it is referenced in nginx configuration file. |
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
952 Even so, some embedded variables still cannot be assigned a value. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
953 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
954 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
955 <tag-name id="s_warn"><literal>s.warn(<value>string</value>)</literal></tag-name> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
956 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
957 writes a sent <literal>string</literal> to the error log |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
958 on the <literal>warning</literal> level of logging |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
959 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
960 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
961 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
962 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
963 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
964 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
965 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
966 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
967 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
968 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
969 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
970 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
971 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
972 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
973 |
2628 | 974 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
975 <section id="headers" name="Headers"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
976 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
977 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
978 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
979 <tr><td><link id="headers_constructor"><literal>Headers()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
980 <tr><td><link id="headers_append"><literal>Headers.append()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
981 <tr><td><link id="headers_delete"><literal>Headers.delete()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
982 <tr><td><link id="headers_get"><literal>Headers.get()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
983 <tr><td><link id="headers_getall"><literal>Headers.getAll()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
984 <tr><td><link id="headers_foreach"><literal>Headers.forEach()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
985 <tr><td><link id="headers_has"><literal>Headers.has()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
986 <tr><td><link id="headers_set"><literal>Headers.set()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
987 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
988 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
989 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
990 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
991 The <literal>Headers</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
992 <link id="ngx_fetch"><literal>Fetch API</literal></link> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
993 is available since <link doc="changes.xml" id="njs0.5.1">0.5.1</link>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
994 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
995 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
996 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
997 A new <literal>Headers</literal> object can be created using the |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
998 <link id="headers_constructor"><literal>Headers()</literal></link> constructor: |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
999 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>): |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1000 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1001 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1002 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1003 <tag-name id="headers_constructor"><literal>Headers([<value>init</value>])</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1004 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1005 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1006 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1007 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1008 <tag-name><literal>init</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1009 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1010 An object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1011 prepopulating the <literal>Headers</literal> object, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1012 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1013 an <literal>array</literal> of name-value pairs, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1014 or an existing <literal>Headers</literal> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1015 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1016 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1017 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1018 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1019 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1020 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1021 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1022 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1023 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1024 A new <literal>Headers</literal> object can be created |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1025 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1026 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1027 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1028 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1029 <tag-name id="headers_append"><literal>append()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1030 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1031 Appends a new value into an existing header in the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1032 <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1033 or adds the header if it does not already exist |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1034 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1035 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1036 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1037 <tag-name id="headers_delete"><literal>delete()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1038 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1039 Deletes a header from the <literal>Headers</literal> object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1040 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1041 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1042 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1043 <tag-name id="headers_get"><literal>get()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1044 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1045 Returns a string containing the values of all headers with the specified name |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1046 separated by a comma and a space. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1047 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1048 |
2941
8f50cc590cd7
Updated njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2935
diff
changeset
|
1049 <tag-name id="headers_getall"><literal>getAll(<value>name</value>)</literal></tag-name> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1050 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1051 Returns an array containing the values of all headers with the specified name. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1052 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1053 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1054 <tag-name id="headers_foreach"><literal>forEach()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1055 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1056 Executes a provided function once for each key/value pair |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1057 in the <literal>Headers</literal> object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1058 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1059 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1060 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1061 <tag-name id="headers_has"><literal>has()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1062 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1063 Returns a boolean value |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1064 indicating whether a header with the specified name exists. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1065 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1066 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1067 <tag-name id="headers_set"><literal>set()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1068 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1069 Sets a new value for an existing header inside |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1070 the <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1071 or adds the header if it does not already exist |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1072 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1073 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1074 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1075 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1076 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1077 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1078 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1079 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1080 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1081 <section id="request" name="Request"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1082 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1083 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1084 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1085 <tr><td><link id="request_constructor"><literal>Request()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1086 <tr><td><link id="request_arraybuffer"><literal>Request.arrayBuffer()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1087 <tr><td><link id="request_bodyused"><literal>Request.bodyUsed</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1088 <tr><td><link id="request_cache"><literal>Request.cache</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1089 <tr><td><link id="request_credentials"><literal>Request.credentials</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1090 <tr><td><link id="request_headers"><literal>Request.headers</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1091 <tr><td><link id="request_json"><literal>Request.json()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1092 <tr><td><link id="request_method"><literal>Request.method</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1093 <tr><td><link id="request_mode"><literal>Request.mode</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1094 <tr><td><link id="request_text"><literal>Request.text()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1095 <tr><td><link id="request_url"><literal>Request.url</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1096 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1097 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1098 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1099 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1100 The <literal>Request</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1101 <link id="ngx_fetch"><literal>Fetch API</literal></link> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1102 is available since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1103 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1104 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1105 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1106 A new <literal>Request</literal> object can be created using the |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1107 <link id="request_constructor"><literal>Request()</literal></link> constructor: |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1108 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1109 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1110 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1111 <tag-name id="request_constructor"><literal>Request[<value>resource</value>[, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1112 <value>options</value>]])</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1113 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1114 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1115 Creates a <literal>Request</literal> object to fetch |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1116 that can be passed later to |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1117 <link id="ngx_fetch"><literal>ngx.fetch()</literal></link>. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1118 The <literal>resource</literal> can be a URL |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1119 or an existing <literal>Request</literal> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1120 The <literal>options</literal> is an optional argument |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1121 that is expected to be an object with the following keys: |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1122 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1123 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1124 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1125 <tag-name><literal>body</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1126 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1127 The request body, by default is empty. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1128 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1129 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1130 <tag-name><literal>headers</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1131 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1132 The response headers object— |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1133 the object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1134 prepopulating the <link id="headers"><literal>Headers</literal></link> object, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1135 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1136 an <literal>array</literal> of name-value pairs, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1137 or an existing <link id="headers"><literal>Headers</literal></link> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1138 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1139 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1140 <tag-name><literal>method</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1141 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1142 The HTTP method, by default the GET method is used. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1143 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1144 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1145 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1146 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1147 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1148 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1149 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1150 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1151 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1152 A new <literal>Request</literal> object can be created |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1153 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1154 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1155 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1156 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1157 <tag-name id="request_arraybuffer"><literal>arrayBuffer()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1158 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1159 Returns a <literal>Promise</literal> that resolves with |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1160 an <literal>ArrayBuffer</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1161 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1162 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1163 <tag-name id="request_bodyused"><literal>bodyUsed</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1164 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1165 A boolean value, <literal>true</literal> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1166 if the body was used in the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1167 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1168 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1169 <tag-name id="request_cache"><literal>cache</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1170 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1171 Contains the cache mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1172 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1173 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1174 <tag-name id="request_credentials"><literal>credentials</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1175 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1176 Contains the credentials of the request, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1177 by default is <literal>same-origin</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1178 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1179 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1180 <tag-name id="request_headers"><literal>headers</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1181 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1182 The <link id="headers"><literal>Headers</literal></link> read-only object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1183 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1184 <link id="request"><literal>Request</literal></link>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1185 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1186 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1187 <tag-name id="request_json"><literal>json()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1188 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1189 Returns a <literal>Promise</literal> that resolves with |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1190 the result of parsing the request body as JSON. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1191 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1192 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1193 <tag-name id="request_method"><literal>method</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1194 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1195 Contains the request method. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1196 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1197 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1198 <tag-name id="request_mode"><literal>mode</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1199 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1200 Contains the mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1201 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1202 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1203 <tag-name id="request_text"><literal>text()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1204 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1205 Returns a <literal>Promise</literal> that resolves with a |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1206 string representation of the request body. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1207 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1208 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1209 <tag-name id="request_url"><literal>url</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1210 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1211 Contains the URL of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1212 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1213 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1214 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1215 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1216 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1217 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1218 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1219 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1220 <section id="response" name="Response"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1221 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1222 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1223 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1224 <tr><td><link id="response_constructor"><literal>Response()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1225 <tr><td><link id="response_arraybuffer"><literal>Response.arrayBuffer()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1226 <tr><td><link id="response_bodyused"><literal>Response.bodyUsed</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1227 <tr><td><link id="response_headers"><literal>Response.headers</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1228 <tr><td><link id="response_json"><literal>Response.json()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1229 <tr><td><link id="response_ok"><literal>Response.ok</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1230 <tr><td><link id="response_redirect"><literal>Response.redirected</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1231 <tr><td><link id="response_status"><literal>Response.status</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1232 <tr><td><link id="response_statustext"><literal>Response.statusText</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1233 <tr><td><link id="response_text"><literal>Response.text()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1234 <tr><td><link id="response_type"><literal>Response.type</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1235 <tr><td><link id="response_url"><literal>Response.url</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1236 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1237 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1238 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1239 <para> |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1240 The <literal>Response</literal> interface is available since |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1241 <link doc="changes.xml" id="njs0.5.1">0.5.1</link>. |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1242 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1243 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1244 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1245 A new <literal>Response</literal> object can be created using the |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1246 <link id="response_constructor"><literal>Response()</literal></link> constructor |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1247 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>): |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1248 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1249 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1250 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1251 <tag-name id="response_constructor"><literal>Response[<value>body</value>[, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1252 <value>options</value>]])</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1253 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1254 Creates a <literal>Response</literal> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1255 The <literal>body</literal> is an optional argument, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1256 can be a <literal>string</literal> or a <literal>buffer</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1257 by default is <literal>null</literal>. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1258 The <literal>options</literal> is an optional argument |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1259 that is expected to be an object with the following keys: |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1260 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1261 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1262 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1263 <tag-name><literal>headers</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1264 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1265 The response headers object— |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1266 the object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1267 prepopulating the <link id="headers"><literal>Headers</literal></link> object, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1268 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1269 an <literal>array</literal> of name-value pairs, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1270 or an existing <link id="headers"><literal>Headers</literal></link> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1271 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1272 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1273 <tag-name><literal>status</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1274 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1275 The status code of the response. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1276 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1277 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1278 <tag-name><literal>statusText</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1279 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1280 The status message corresponding to the status code. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1281 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1282 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1283 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1284 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1285 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1286 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1287 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1288 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1289 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1290 A new <literal>Response()</literal> object can be created |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1291 with the following properties and methods: |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1292 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1293 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1294 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1295 <tag-name id="response_arraybuffer"><literal>arrayBuffer()</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1296 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1297 Takes a <literal>Response</literal> stream and reads it to completion. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1298 Returns a <literal>Promise</literal> that resolves with |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1299 an <literal>ArrayBuffer</literal>. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1300 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1301 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1302 <tag-name id="response_bodyused"><literal>bodyUsed</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1303 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1304 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1305 if the body was read. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1306 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1307 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1308 <tag-name id="response_headers"><literal>headers</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1309 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1310 The <link id="headers"><literal>Headers</literal></link> read-only object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1311 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1312 <link id="response"><literal>Response</literal></link>. |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1313 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1314 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1315 <tag-name id="response_json"><literal>json()</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1316 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1317 Takes a <literal>Response</literal> stream and reads it to completion. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1318 Returns a <literal>Promise</literal> that resolves with |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1319 the result of parsing the body text as JSON. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1320 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1321 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1322 <tag-name id="response_ok"><literal>ok</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1323 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1324 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1325 if the response was successful (status codes between 200–299). |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1326 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1327 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1328 <tag-name id="response_redirect"><literal>redirected</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1329 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1330 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1331 if the response is the result of a redirect. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1332 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1333 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1334 <tag-name id="response_status"><literal>status</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1335 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1336 The status code of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1337 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1338 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1339 <tag-name id="response_statustext"><literal>statusText</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1340 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1341 The status message corresponding to the status code. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1342 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1343 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1344 <tag-name id="response_text"><literal>text()</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1345 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1346 Takes a <literal>Response</literal> stream and reads it to completion. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1347 Returns a <literal>Promise</literal> that resolves with a string. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1348 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1349 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1350 <tag-name id="response_type"><literal>type</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1351 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1352 The type of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1353 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1354 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1355 <tag-name id="response_url"><literal>url</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1356 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1357 The URL of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1358 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1359 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1360 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1361 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1362 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1363 </section> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1364 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1365 |
2628 | 1366 <section id="ngx" name="ngx"> |
1367 | |
1368 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1369 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1370 <tr><td><link id="ngx_build"><literal>ngx.build</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1371 <tr><td><link id="ngx_conf_file_path"><literal>ngx.conf_file_path</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1372 <tr><td><link id="ngx_conf_prefix"><literal>ngx.conf_prefix</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1373 <tr><td><link id="ngx_error_log_path"><literal>ngx.error_log_path</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1374 <tr><td><link id="ngx_fetch"><literal>ngx.fetch()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1375 <tr><td><link id="ngx_log"><literal>ngx.log()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1376 <tr><td><link id="ngx_prefix"><literal>ngx.prefix</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1377 <tr><td><link id="ngx_version"><literal>ngx.version</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1378 <tr><td><link id="ngx_version_number"><literal>ngx.version_number</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1379 <tr><td><link id="ngx_worker_id"><literal>ngx.worker_id</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1380 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1381 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1382 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1383 <para> |
2628 | 1384 The <literal>ngx</literal> global object is available |
1385 since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>. | |
1386 <list type="tag"> | |
1387 | |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1388 <tag-name id="ngx_build"><literal>ngx.build</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1389 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1390 a string containing an optional nginx build name, corresponds to the |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1391 <link doc="../configure.xml" id="build"><literal>--build=name</literal></link> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1392 argument |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1393 of the <link doc="../configure.xml">configure</link> script, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1394 by default is <literal>""</literal> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1395 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1396 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1397 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1398 <tag-name id="ngx_conf_file_path"><literal>ngx.conf_file_path</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1399 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1400 a string containing the file path to current nginx configuration file |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1401 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1402 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1403 |
2910
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1404 <tag-name id="ngx_conf_prefix"><literal>ngx.conf_prefix</literal></tag-name> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1405 <tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1406 a string containing the file path to |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1407 <link doc="../configure.xml" id="conf_path">nginx configuration prefix</link>— |
2910
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1408 the directory where nginx is currently looking for configuration |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1409 (<link doc="changes.xml" id="njs0.7.8">0.7.8</link>) |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1410 </tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1411 |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1412 <tag-name id="ngx_error_log_path"><literal>ngx.error_log_path</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1413 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1414 a string containing the file path to the current |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1415 <link doc="../ngx_core_module.xml" id="error_log">error log</link> file |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1416 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1417 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1418 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1419 <tag-name id="ngx_fetch"><literal>ngx.fetch(<value>resource</value>, |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1420 [<value>options</value>])</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1421 <tag-desc> |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1422 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1423 Makes a request to fetch a <value>resource</value> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1424 (<link doc="changes.xml" id="njs0.5.1">0.5.1</link>), which can be an |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1425 URL or the <link id="request"><literal>Request</literal></link> object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1426 (<link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1427 Returns a <literal>Promise</literal> that resolves with |
2668
e067ad74b0cd
Corrected links to Response Object in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2667
diff
changeset
|
1428 the <link id="response"><literal>Response</literal></link> object. |
2774
7255a5468474
Documented HTTPS support for ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2735
diff
changeset
|
1429 Since <link doc="changes.xml" id="njs0.7.0">0.7.0</link>, |
7255a5468474
Documented HTTPS support for ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2735
diff
changeset
|
1430 the <literal>https://</literal> scheme is supported, |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1431 redirects are not handled. |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1432 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1433 |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1434 <para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1435 If the URL in the <value>resource</value> is specified as a domain name, |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1436 it is determined using a |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1437 <link doc="../http/ngx_http_core_module.xml" id="resolver"/>. |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1438 If the <literal>https://</literal> scheme is specified, the |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1439 <link doc="../http/ngx_http_js_module.xml" id="js_fetch_trusted_certificate"/> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1440 directive should be configured |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1441 for the authentication of the <value>resource</value>'s HTTPS server. |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1442 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1443 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1444 <para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1445 The <literal>options</literal> parameter is expected to be an object |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1446 with the following keys: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1447 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1448 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1449 <tag-name id="fetch_body"><literal>body</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1450 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1451 request body, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1452 by default is empty |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1453 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1454 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1455 <tag-name id="fetch_buffer_size"><literal>buffer_size</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1456 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1457 the buffer size for reading the response, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1458 by default is <literal>4096</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1459 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1460 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1461 <tag-name id="fetch_headers"><literal>headers</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1462 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1463 request <link id="headers">headers</link> object |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1464 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1465 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1466 <tag-name id="fetch_get"><literal>max_response_body_size</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1467 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1468 the maximum size of the response body in bytes, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1469 by default is <literal>32768</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1470 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1471 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1472 <tag-name id="fetch_method"><literal>method</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1473 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1474 HTTP method, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1475 by default the <literal>GET</literal> method is used |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1476 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1477 |
2775
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1478 <tag-name id="fetch_verify"><literal>verify</literal></tag-name> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1479 <tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1480 enables or disables verification of the HTTPS server certificate, |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1481 by default is <literal>true</literal> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1482 (<link doc="changes.xml" id="njs0.7.0">0.7.0</link>) |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1483 </tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1484 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1485 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1486 Example: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1487 <example> |
2840
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1488 let reply = await ngx.fetch('http://nginx.org/'); |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1489 let body = await reply.text(); |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1490 |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1491 r.return(200, body); |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1492 </example> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1493 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1494 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1495 |
2628 | 1496 <tag-name id="ngx_log"><literal>ngx.log</literal>(<value>level</value>, |
1497 <value>message</value>)</tag-name> | |
1498 <tag-desc> | |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1499 writes a message to the error log with the specified level of logging. |
2628 | 1500 The <value>level</value> parameter specifies one of the log levels, |
1501 the <value>message</value> parameter can be a string or Buffer. | |
1502 The following log levels can be specified: | |
1503 <literal>ngx.INFO</literal>, | |
1504 <literal>ngx.WARN</literal>, and | |
1505 <literal>ngx.ERR</literal>. | |
2877
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1506 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1507 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1508 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1509 <link doc="../dev/development_guide.xml" id="logging">hardcoded</link> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1510 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1511 only first 2048 bytes of the string can be logged. |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1512 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1513 </para> |
2628 | 1514 </tag-desc> |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1515 |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1516 <tag-name id="ngx_prefix"><literal>ngx.prefix</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1517 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1518 a string containing the file path to |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1519 <link doc="../configure.xml" id="prefix">nginx prefix</link>— |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1520 a directory that keeps server files |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1521 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1522 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1523 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1524 <tag-name id="ngx_version"><literal>ngx.version</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1525 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1526 a string containing nginx version, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1527 for example: <literal>1.25.0</literal> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1528 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1529 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1530 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1531 <tag-name id="ngx_version_number"><literal>ngx.version_number</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1532 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1533 a number containing nginx version, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1534 for example: <literal>1025000</literal> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1535 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1536 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1537 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1538 <tag-name id="ngx_worker_id"><literal>ngx.worker_id</literal></tag-name> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1539 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1540 a number that corresponds to nginx internal worker id, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1541 the value is between <literal>0</literal> and the value specified in the |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1542 <link doc="../ngx_core_module.xml" id="worker_processes"/> directive |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1543 (<link doc="changes.xml" id="njs0.8.0">0.8.0</link>) |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1544 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1545 |
2628 | 1546 </list> |
1547 </para> | |
1548 | |
1549 </section> | |
1550 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1551 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1552 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1553 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
1554 <section id="builtin_objects" name="built-in objects"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1555 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1556 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1557 <section id="builtin_crypto" name="crypto"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1558 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1559 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1560 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1561 <tr><td><link id="crypto_get_random_values"><literal>сrypto.getRandomValues()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1562 <tr><td><link id="crypto_subtle_encrypt"><literal>сrypto.subtle.encrypt()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1563 <tr><td><link id="crypto_subtle_decrypt"><literal>сrypto.subtle.decrypt()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1564 <tr><td><link id="crypto_subtle_derive_bits"><literal>сrypto.subtle.deriveBits()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1565 <tr><td><link id="crypto_subtle_derive_key"><literal>сrypto.subtle.deriveKey()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1566 <tr><td><link id="crypto_subtle_digest"><literal>сrypto.subtle.digest()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1567 <tr><td><link id="crypto_subtle_export_key"><literal>сrypto.subtle.exportKey()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1568 <tr><td><link id="crypto_subtle_generate_key"><literal>сrypto.subtle.generateKey()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1569 <tr><td><link id="crypto_subtle_import_key"><literal>сrypto.subtle.importKey()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1570 <tr><td><link id="crypto_subtle_sign"><literal>сrypto.subtle.sign()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1571 <tr><td><link id="crypto_subtle_verify"><literal>сrypto.subtle.verify()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1572 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1573 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1574 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1575 <para> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1576 The <literal>crypto</literal> object is a global object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1577 that allows using cryptographic functionality |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1578 (since <link doc="changes.xml" id="njs0.7.0">0.7.0</link>). |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1579 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1580 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1581 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1582 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1583 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1584 <tag-name id="crypto_get_random_values"><literal>сrypto.getRandomValues</literal>(<link id="crypto_get_random_values_array"><literal>typedArray</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1585 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1586 Gets cryptographically strong random values. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1587 Returns the same array passed as <literal>typedArray</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1588 but with its contents replaced with the newly generated random numbers. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1589 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1590 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1591 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1592 <tag-name id="crypto_get_random_values_array"><literal>typedArray</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1593 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1594 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1595 <literal>Int8Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1596 <literal>Int16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1597 <literal>Uint16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1598 <literal>Int32Array</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1599 <literal>Uint32Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1600 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1601 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1602 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1603 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1604 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1605 <tag-name id="crypto_subtle_encrypt"><literal>сrypto.subtle.encrypt</literal>(<link id="crypto_encrypt_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1606 <link id="crypto_encrypt_key"><literal>key</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1607 <link id="crypto_encrypt_data"><literal>data</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1608 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1609 Encrypts <link id="crypto_encrypt_data"><literal>data</literal></link> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1610 using the provided |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1611 <link id="crypto_encrypt_algorithm"><literal>algorithm</literal></link> and |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1612 <link id="crypto_encrypt_key"><literal>key</literal></link>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1613 Returns a <literal>Promise</literal> that fulfills with |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1614 an <literal>ArrayBuffer</literal> containing the ciphertext. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1615 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1616 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1617 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1618 <tag-name id="crypto_encrypt_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1619 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1620 an object that specifies |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1621 the algorithm to be used and any extra parameters if required: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1622 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1623 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1624 <listitem id="rsa_oaep_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1625 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1626 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1627 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1628 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1629 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1630 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1631 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1632 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1633 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1634 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1635 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1636 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1637 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1638 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1639 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1640 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1641 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1642 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1643 <listitem id="aes_ctr_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1644 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1645 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1646 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1647 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1648 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1649 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1650 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1651 should be set to <literal>AES-CTR</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1652 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1653 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1654 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1655 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1656 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1657 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1658 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1659 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1660 must be 16 bytes long (the AES block size). |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1661 The rightmost length bits of this block are used for the counter, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1662 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1663 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1664 then the first half of counter is the nonce |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1665 and the second half is used for the counter |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1666 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1667 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1668 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1669 <literal>length</literal> is the number of bits in the counter block |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1670 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1671 The counter must be big enough that it doesn't wrap. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1672 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1673 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1674 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1675 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1676 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1677 <listitem id="aes_cbc_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1678 for <literal>AES-CBC</literal>, pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1679 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1680 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1681 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1682 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1683 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1684 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1685 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1686 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1687 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1688 <literal>iv</literal> or the initialization vector, is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1689 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1690 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1691 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1692 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1693 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1694 However, it need not be secret, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1695 for example, it may be transmitted unencrypted along with the ciphertext. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1696 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1697 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1698 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1699 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1700 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1701 <listitem id="aes_gcm_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1702 for <literal>AES-GCM</literal>, pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1703 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1704 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1705 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1706 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1707 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1708 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1709 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1710 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1711 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1712 <literal>iv</literal> or the initialization vector, is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1713 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1714 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1715 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1716 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1717 and must be unique for every encryption operation carried out with a given key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1718 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1719 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1720 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1721 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1722 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1723 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1724 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1725 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1726 will not be encrypted but will be authenticated along with the encrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1727 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1728 then the same data must be specified in the corresponding call to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1729 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1730 if the data given to the <literal>decrypt()</literal> call |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1731 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1732 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
1733 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1734 must be smaller than <literal>2^64 - 1</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1735 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1736 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1737 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1738 <literal>tagLength</literal> (optional, default is <literal>128</literal>) - |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1739 a <literal>number</literal> that determines the size in bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1740 of the authentication tag generated in the encryption operation |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1741 and used for authentication in the corresponding decryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1742 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1743 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1744 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1745 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1746 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1747 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1748 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1749 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1750 The AES-GCM specification recommends that it should be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1751 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1752 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1753 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1754 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1755 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1756 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1757 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1758 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1759 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1760 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1761 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1762 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1763 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1764 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1765 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1766 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1767 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1768 <tag-name id="crypto_encrypt_key"><literal>key</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1769 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
1770 a <link id="cryptokey"><literal>CryptoKey</literal></link> that contains |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1771 the key to be used for encryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1772 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1773 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1774 <tag-name id="crypto_encrypt_data"><literal>data</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1775 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1776 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1777 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1778 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1779 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1780 that contains |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1781 the data to be encrypted (also known as the plaintext) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1782 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1783 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1784 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1785 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1786 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1787 <tag-name id="crypto_subtle_decrypt"><literal>сrypto.subtle.decrypt</literal>(<link id="crypto_decrypt_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1788 <link id="crypto_decrypt_key"><literal>key</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1789 <link id="crypto_decrypt_data"><literal>data</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1790 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1791 Decrypts encrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1792 Returns a <literal>Promise</literal> with the decrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1793 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1794 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1795 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1796 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1797 <tag-name id="crypto_decrypt_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1798 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1799 an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1800 that specifies the algorithm to be used, and any extra parameters as required. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1801 The values given for the extra parameters must match |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1802 those passed into the corresponding <literal>encrypt()</literal> call. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1803 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1804 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1805 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1806 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1807 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1808 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1809 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1810 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1811 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1812 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1813 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1814 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1815 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1816 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1817 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1818 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1819 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1820 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1821 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1822 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1823 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1824 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1825 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1826 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1827 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1828 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1829 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1830 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1831 should be set to <literal>AES-CTR</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1832 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1833 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1834 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1835 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1836 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1837 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1838 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1839 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1840 must be 16 bytes long (the AES block size). |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1841 The rightmost length bits of this block are used for the counter, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1842 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1843 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1844 then the first half of counter is the nonce |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1845 and the second half is used for the counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1846 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1847 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1848 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1849 <literal>length</literal> is the number of bits in the counter block |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1850 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1851 The counter must be big enough that it doesn't wrap. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1852 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1853 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1854 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1855 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1856 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1857 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1858 for <literal>AES-CBC</literal>, pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1859 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1860 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1861 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1862 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1863 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1864 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1865 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1866 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1867 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1868 <literal>iv</literal> or the initialization vector, is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1869 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1870 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1871 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1872 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1873 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1874 However, it need not be secret |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1875 (for example, it may be transmitted unencrypted along with the ciphertext). |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1876 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1877 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1878 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1879 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1880 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1881 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1882 for <literal>AES-GCM</literal>, pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1883 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1884 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1885 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1886 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1887 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1888 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1889 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1890 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1891 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1892 <literal>iv</literal> or the initialization vector, is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1893 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1894 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1895 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1896 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1897 and must be unique for every encryption operation carried out with a given key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1898 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1899 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1900 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1901 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1902 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1903 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1904 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1905 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1906 will not be encrypted but will be authenticated along with the encrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1907 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1908 then the same data must be specified in the corresponding call to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1909 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1910 if the data given to the <literal>decrypt()</literal> call |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1911 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1912 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
1913 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1914 must be smaller than <literal>2^64 - 1</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1915 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1916 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1917 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1918 <literal>tagLength</literal> (optional, default is <literal>128</literal>) - |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1919 a <literal>number</literal> that determines the size in bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1920 of the authentication tag generated in the encryption operation |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1921 and used for authentication in the corresponding decryption. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1922 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1923 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1924 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1925 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1926 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1927 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1928 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1929 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1930 The AES-GCM specification recommends that it should be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1931 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1932 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1933 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1934 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1935 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1936 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1937 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1938 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1939 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1940 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1941 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1942 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1943 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1944 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1945 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1946 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1947 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1948 <tag-name id="crypto_decrypt_key"><literal>key</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1949 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
1950 a <link id="cryptokey"><literal>CryptoKey</literal></link> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1951 that contains the key to be used for decryption. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1952 If <literal>RSA-OAEP</literal> is used, this is the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1953 <literal>privateKey</literal> property of the |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
1954 <link id="cryptokeypair"><literal>CryptoKeyPair</literal></link> object. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1955 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1956 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1957 <tag-name id="crypto_decrypt_data"><literal>data</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1958 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1959 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1960 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1961 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1962 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1963 that contains the data to be decrypted (also known as ciphertext) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1964 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1965 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1966 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1967 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1968 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1969 <tag-name id="crypto_subtle_derive_bits"><literal>сrypto.subtle.deriveBits</literal>(<link id="crypto_derive_bits_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1970 <link id="crypto_derive_bits_basekey"><literal>baseKey</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1971 <link id="crypto_derive_bits_length"><literal>length</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1972 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1973 Derives an array of bits from a base key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1974 Returns a <literal>Promise</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1975 which will be fulfilled with an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1976 <literal>ArrayBuffer</literal> that contains the derived bits. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1977 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1978 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1979 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1980 <tag-name id="crypto_derive_bits_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1981 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1982 is an object that defines the derivation algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1983 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1984 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1985 <listitem id="hkdf_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1986 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1987 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1988 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1989 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1990 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1991 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1992 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1993 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1994 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1995 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1996 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1997 <literal>hash</literal> is a string with the digest algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1998 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1999 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2000 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2001 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2002 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2003 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2004 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2005 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2006 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2007 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2008 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2009 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2010 with the same length as the output of the <literal>digest</literal> function. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2011 Unlike the input key material passed into <literal>deriveKey()</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2012 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2013 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2014 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2015 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2016 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2017 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2018 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2019 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2020 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2021 used to bind the derived key to an application or context, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2022 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2023 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2024 This property is required but may be an empty buffer. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2025 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2026 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2027 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2028 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2029 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2030 <listitem id="pbkdf2_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2031 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2032 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2033 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2034 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2035 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2036 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2037 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2038 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2039 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2040 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2041 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2042 <literal>hash</literal> is a string with the digest algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2043 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2044 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2045 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2046 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2047 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2048 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2049 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2050 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2051 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2052 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2053 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2054 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2055 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2056 Unlike the input key material passed into <literal>deriveKey()</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2057 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2058 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2059 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2060 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2061 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2062 that represents the number of times the hash function will be executed |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2063 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2064 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2065 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2066 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2067 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2068 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2069 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2070 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2071 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2072 <tag-name id="crypto_derive_bits_basekey"><literal>baseKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2073 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2074 is a <link id="cryptokey"><literal>CryptoKey</literal></link> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2075 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2076 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2077 for example, for <literal>PBKDF2</literal> it might be a password, |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2078 imported as a <link id="cryptokey"><literal>CryptoKey</literal></link> using |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2079 <link id="crypto_subtle_import_key"><literal>сrypto.subtle.importKey()</literal></link> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2080 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2081 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2082 <tag-name id="crypto_derive_bits_length"><literal>length</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2083 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2084 is a number representing the number of bits to derive. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2085 For browsers compatibility, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2086 the number should be a multiple of <literal>8</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2087 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2088 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2089 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2090 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2091 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2092 <tag-name id="crypto_subtle_derive_key"><literal>сrypto.subtle.deriveKey</literal>(<link id="crypto_derive_key_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2093 <link id="crypto_derive_key_basekey"><literal>baseKey</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2094 <link id="crypto_derive_key_derivedkeyalg"><literal>derivedKeyAlgorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2095 <link id="crypto_derive_key_extractable"><literal>extractable</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2096 <link id="crypto_derive_key_keyusages"><literal>keyUsages</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2097 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2098 Derives a secret key from a master key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2099 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2100 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2101 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2102 <tag-name id="crypto_derive_key_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2103 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2104 is an object that defines the derivation algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2105 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2106 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2107 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2108 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2109 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2110 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2111 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2112 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2113 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2114 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2115 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2116 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2117 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2118 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2119 <literal>hash</literal> is a string with the digest algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2120 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2121 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2122 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2123 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2124 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2125 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2126 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2127 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2128 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2129 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2130 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2131 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2132 with the same length as the output of the <literal>digest</literal> function. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2133 Unlike the input key material passed into <literal>deriveKey()</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2134 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2135 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2136 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2137 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2138 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2139 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2140 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2141 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2142 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2143 used to bind the derived key to an application or context, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2144 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2145 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2146 This property is required but may be an empty buffer. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2147 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2148 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2149 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2150 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2151 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2152 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2153 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2154 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2155 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2156 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2157 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2158 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2159 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2160 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2161 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2162 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2163 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2164 <literal>hash</literal> is a string with the digest algorithm to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2165 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2166 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2167 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2168 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2169 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2170 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2171 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2172 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2173 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2174 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2175 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2176 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2177 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2178 Unlike the input key material passed into <literal>deriveKey()</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2179 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2180 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2181 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2182 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2183 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2184 that represents the number of times the hash function will be executed |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2185 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2186 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2187 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2188 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2189 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2190 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2191 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2192 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2193 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2194 <tag-name id="crypto_derive_key_basekey"><literal>baseKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2195 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2196 is a <link id="cryptokey"><literal>CryptoKey</literal></link> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2197 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2198 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2199 for example, for <literal>PBKDF2</literal> it might be a password, |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2200 imported as a <link id="cryptokey"><literal>CryptoKey</literal></link> using |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
2201 <link id="crypto_subtle_import_key"><literal>сrypto.subtle.importKey()</literal></link>. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2202 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2203 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2204 <tag-name id="crypto_derive_key_derivedkeyalg"><literal>derivedKeyAlgorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2205 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2206 is an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2207 that defines the algorithm the derived key will be used for: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2208 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2209 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2210 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2211 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2212 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2213 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2214 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2215 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2216 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2217 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2218 should be set to <literal>HMAC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2219 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2220 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2221 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2222 <literal>hash</literal> is a string with the name of the digest function to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2223 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2224 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2225 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2226 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2227 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2228 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2229 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2230 <literal>length</literal> (optional) is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2231 that represents the length in bits of the key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2232 If not specified, the length of the key is equal to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2233 the block size of the chozen hash function |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2234 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2235 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2236 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2237 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2238 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2239 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2240 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2241 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2242 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2243 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2244 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2245 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2246 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2247 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2248 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2249 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2250 should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2251 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2252 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2253 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2254 depending on the algorithm used |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2255 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2256 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2257 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2258 <literal>length</literal> is a <literal>number</literal> that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2259 the length in bits of the key to generate: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2260 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2261 <literal>192</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2262 <literal>256</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2263 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2264 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2265 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2266 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2267 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2268 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2269 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2270 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2271 <tag-name id="crypto_derive_key_extractable"><literal>extractable</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2272 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2273 is a boolean value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2274 that indicates whether it will be possible to export the key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2275 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2276 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2277 <tag-name id="crypto_derive_key_keyusages"><literal>keyUsages</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2278 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2279 is an <literal>Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2280 that indicates what can be done with the derived key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2281 The key usages must be allowed by the algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2282 set in <literal>derivedKeyAlgorithm</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2283 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2284 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2285 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2286 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2287 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2288 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2289 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2290 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2291 <tag-name><literal>decrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2292 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2293 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2294 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2295 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2296 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2297 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2298 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2299 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2300 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2301 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2302 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2303 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2304 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2305 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2306 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2307 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2308 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2309 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2310 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2311 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2312 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2313 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2314 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2315 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2316 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2317 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2318 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2319 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2320 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2321 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2322 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2323 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2324 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2325 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2326 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2327 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2328 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2329 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2330 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2331 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2332 <tag-name id="crypto_subtle_digest"><literal>сrypto.subtle.digest</literal>(<link id="crypto_digest_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2333 <link id="crypto_digest_data"><literal>data</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2334 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2335 Generates a digest of the given data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2336 Takes as its arguments an identifier for the digest algorithm to use |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2337 and the data to digest. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2338 Returns a <literal>Promise</literal> which will be fulfilled with the digest. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2339 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2340 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2341 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2342 <tag-name id="crypto_digest_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2343 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2344 is a string that defines the hash function to use: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2345 <literal>SHA-1</literal> (not for cryptographic applications), |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2346 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2347 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2348 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2349 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2350 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2351 <tag-name id="crypto_digest_data"><literal>data</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2352 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2353 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2354 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2355 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2356 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2357 that contains the data to be digested |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2358 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2359 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2360 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2361 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2362 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2363 <tag-name id="crypto_subtle_export_key"><literal>сrypto.subtle.exportKey</literal>(<link id="crypto_export_key_format"><literal>format</literal></link>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2364 <link id="crypto_export_key_keydata"><literal>key</literal></link>)</tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2365 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2366 Exports a key: takes a key as |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2367 a <link id="cryptokey"><literal>CryptoKey</literal></link> object |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2368 and returns the key in an external, portable format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2369 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2370 If the <literal>format</literal> was <literal>jwk</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2371 then the <literal>Promise</literal> fulfills with a JSON object |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2372 containing the key. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2373 Otherwise, the promise fulfills with an |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2374 <literal>ArrayBuffer</literal> containing the key. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2375 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2376 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2377 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2378 <tag-name id="crypto_export_key_format"><literal>format</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2379 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2380 a string that describes the data format in which the key should be exported, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2381 can be the following: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2382 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2383 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2384 <tag-name><literal>raw</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2385 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2386 the raw data format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2387 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2388 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2389 <tag-name><literal>pkcs8</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2390 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2391 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2392 <link url="https://datatracker.ietf.org/doc/html/rfc5208">PKCS #8</link> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2393 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2394 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2395 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2396 <tag-name><literal>spki</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2397 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2398 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2399 <link url="https://datatracker.ietf.org/doc/html/rfc5280#section-4.1">SubjectPublicKeyInfo</link> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2400 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2401 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2402 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2403 <tag-name><literal>jwk</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2404 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2405 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2406 <link url="https://datatracker.ietf.org/doc/html/rfc7517">JSON Web Key</link> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2407 (JWK) format (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>) |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2408 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2409 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2410 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2411 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2412 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2413 <tag-name id="crypto_export_key_keydata"><literal>key</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2414 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2415 the <link id="cryptokey"><literal>CryptoKey</literal></link> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2416 that contains the key to be exported |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2417 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2418 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2419 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2420 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2421 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2422 <tag-name id="crypto_subtle_generate_key"><literal>сrypto.subtle.generateKey</literal>(<link id="crypto_generate_key_alg"><literal>algorithm</literal></link>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2423 <link id="crypto_generate_key_extractable"><literal>extractable</literal></link>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2424 <link id="crypto_generate_key_usage"><literal>usage</literal></link>)</tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2425 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2426 Generates a new key for symmetric algorithms |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2427 or key pair for public-key algorithms |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2428 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2429 Returns a <literal>Promise</literal> that fulfills with the generated key |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2430 as |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2431 a <link id="cryptokey"><literal>CryptoKey</literal></link> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
2432 or <link id="cryptokeypair"><literal>CryptoKeyPair</literal></link> object. |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2433 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2434 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2435 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2436 <tag-name id="crypto_generate_key_alg"><literal>algorithm</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2437 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2438 a dictionary object that defines the type of key to generate |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2439 and provides extra algorithm-specific parameters: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2440 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2441 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2442 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2443 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2444 <literal>RSASSA-PKCS1-v1_5</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2445 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2446 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2447 pass the object with the following keys: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2448 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2449 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2450 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2451 <literal>name</literal> is a string, should be set to |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2452 <literal>RSASSA-PKCS1-v1_5</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2453 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2454 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2455 depending on the used algorithm |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2456 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2457 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2458 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2459 <literal>hash</literal> is a string that represents |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2460 the name of the <literal>digest</literal> function to use, can be |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2461 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2462 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2463 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2464 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2465 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2466 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2467 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2468 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2469 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2470 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2471 <literal>ECDSA</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2472 pass the object with the following keys: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2473 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2474 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2475 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2476 <literal>name</literal> is a string, should be set to <literal>ECDSA</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2477 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2478 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2479 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2480 <literal>namedCurve</literal> is a string that represents |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2481 the name of the elliptic curve to use, may be |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2482 <literal>P-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2483 <literal>P-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2484 <literal>P-521</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2485 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2486 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2487 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2488 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2489 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2490 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2491 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2492 <literal>HMAC</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2493 pass the object with the following keys: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2494 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2495 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2496 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2497 <literal>name</literal> is a string, should be set to <literal>HMAC</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2498 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2499 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2500 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2501 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2502 <literal>hash</literal> is a string that represents |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2503 the name of the <literal>digest</literal> function to use, can be |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2504 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2505 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2506 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2507 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2508 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2509 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2510 <literal>length</literal> (optional) is a number that represents |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2511 the length in bits of the key. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2512 If omitted, the length of the key is equal to the length of the digest |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2513 generated by the chosen digest function. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2514 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2515 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2516 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2517 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2518 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2519 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2520 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2521 <literal>AES-CTR</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2522 <literal>AES-CBC</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2523 <literal>AES-GCM</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2524 pass the string identifying the algorithm or an object |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2525 of the form <literal>{ "name": "ALGORITHM" }</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2526 where <literal>ALGORITHM</literal> is the name of the algorithm |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2527 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2528 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2529 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2530 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2531 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2532 <tag-name id="crypto_generate_key_extractable"><literal>extractable</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2533 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2534 boolean value that indicates if it is possible to export the key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2535 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2536 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2537 <tag-name id="crypto_generate_key_usage"><literal>usage</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2538 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2539 an <literal>array</literal> that indicates possible actions with the key: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2540 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2541 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2542 <tag-name><literal>encrypt</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2543 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2544 key for encrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2545 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2546 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2547 <tag-name><literal>decrypt</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2548 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2549 key for decrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2550 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2551 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2552 <tag-name><literal>sign</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2553 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2554 key for signing messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2555 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2556 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2557 <tag-name><literal>verify</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2558 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2559 key for verifying signatures |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2560 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2561 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2562 <tag-name><literal>deriveKey</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2563 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2564 key for deriving a new key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2565 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2566 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2567 <tag-name><literal>deriveBits</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2568 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2569 key for deriving bits |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2570 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2571 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2572 <tag-name><literal>wrapKey</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2573 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2574 key for wrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2575 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2576 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2577 <tag-name><literal>unwrapKey</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2578 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2579 key for unwrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2580 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2581 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2582 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2583 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2584 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2585 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2586 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2587 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2588 <tag-name id="crypto_subtle_import_key"><literal>сrypto.subtle.importKey</literal>(<link id="crypto_import_key_format"><literal>format</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2589 <link id="crypto_import_key_keydata"><literal>keyData</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2590 <link id="crypto_import_key_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2591 <link id="crypto_import_key_extractable"><literal>extractable</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2592 <link id="crypto_import_key_keyusages"><literal>keyUsages</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2593 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2594 Imports a key: takes as input a key in an external, portable format |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2595 and gives a <link id="cryptokey"><literal>CryptoKey</literal></link> object. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2596 Returns a <literal>Promise</literal> that fulfills with the imported key |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2597 as a <link id="cryptokey"><literal>CryptoKey</literal></link> object. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2598 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2599 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2600 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2601 <tag-name id="crypto_import_key_format"><literal>format</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2602 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2603 a string that describes the data format of the key to import, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2604 can be the following: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2605 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2606 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2607 <tag-name><literal>raw</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2608 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2609 the raw data format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2610 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2611 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2612 <tag-name><literal>pkcs8</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2613 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2614 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2615 <link url="https://datatracker.ietf.org/doc/html/rfc5208">PKCS #8</link> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2616 format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2617 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2618 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2619 <tag-name><literal>spki</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2620 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2621 the |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2622 <link url="https://datatracker.ietf.org/doc/html/rfc5280#section-4.1">SubjectPublicKeyInfo</link> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2623 format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2624 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2625 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2626 <tag-name><literal>jwk</literal></tag-name> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2627 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2628 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2629 <link url="https://datatracker.ietf.org/doc/html/rfc7517">JSON Web Key</link> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2630 (JWK) format (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>) |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2631 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2632 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2633 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2634 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2635 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2636 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2637 <tag-name id="crypto_import_key_keydata"><literal>keyData</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2638 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2639 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2640 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2641 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2642 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2643 object that contains the key in the given format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2644 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2645 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2646 <tag-name id="crypto_import_key_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2647 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2648 a dictionary object that defines the type of key to import |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2649 and provides extra algorithm-specific parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2650 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2651 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2652 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2653 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2654 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2655 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2656 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2657 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2658 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2659 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2660 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2661 <literal>name</literal> is a string, should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2662 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2663 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2664 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2665 depending on the used algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2666 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2667 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2668 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2669 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2670 the name of the <literal>digest</literal> function to use, can be |
2950
a412c1fffbf1
Added SHA1 algorithm to сrypto.subtle.importKey in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2942
diff
changeset
|
2671 <literal>SHA-1</literal>, |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2672 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2673 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2674 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2675 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2676 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2677 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2678 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2679 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2680 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2681 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2682 <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2683 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2684 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2685 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2686 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2687 <literal>name</literal> is a string, should be set to <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2688 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2689 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2690 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2691 <literal>namedCurve</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2692 the name of the elliptic curve to use, may be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2693 <literal>P-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2694 <literal>P-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2695 <literal>P-521</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2696 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2697 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2698 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2699 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2700 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2701 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2702 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2703 <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2704 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2705 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2706 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2707 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2708 <literal>name</literal> is a string, should be set to <literal>HMAC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2709 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2710 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2711 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2712 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2713 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2714 the name of the <literal>digest</literal> function to use, can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2715 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2716 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2717 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2718 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2719 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2720 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2721 <literal>length</literal> (optional) is a number that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2722 the length in bits of the key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2723 If omitted, the length of the key is equal to the length of the digest |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2724 generated by the chosen digest function. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2725 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2726 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2727 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2728 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2729 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2730 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2731 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2732 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2733 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2734 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2735 pass the string identifying the algorithm or an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2736 of the form <literal>{ "name": "ALGORITHM" }</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2737 where <literal>ALGORITHM</literal> is the name of the algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2738 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2739 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2740 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2741 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2742 <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2743 pass the <literal>PBKDF2</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2744 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2745 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2746 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2747 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2748 <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2749 pass the <literal>HKDF</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2750 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2751 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2752 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2753 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2754 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2755 <tag-name id="crypto_import_key_extractable"><literal>extractable</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2756 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2757 boolean value that indicates if it is possible to export the key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2758 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2759 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2760 <tag-name id="crypto_import_key_keyusages"><literal>keyUsages</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2761 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2762 an <literal>array</literal> that indicates possible actions with the key: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2763 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2764 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2765 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2766 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2767 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2768 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2769 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2770 <tag-name><literal>decrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2771 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2772 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2773 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2774 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2775 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2776 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2777 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2778 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2779 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2780 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2781 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2782 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2783 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2784 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2785 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2786 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2787 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2788 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2789 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2790 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2791 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2792 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2793 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2794 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2795 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2796 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2797 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2798 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2799 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2800 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2801 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2802 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2803 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2804 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2805 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2806 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2807 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2808 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2809 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2810 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2811 <tag-name id="crypto_subtle_sign"><literal>сrypto.subtle.sign</literal>(<link id="crypto_sign_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2812 <link id="crypto_sign_key"><literal>key</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2813 <link id="crypto_sign_data"><literal>data</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2814 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2815 Returns <literal>signature</literal> as a <literal>Promise</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2816 that fulfills with an <literal>ArrayBuffer</literal> containing the signature. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2817 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2818 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2819 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2820 <tag-name id="crypto_sign_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2821 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2822 is a string or object that specifies the signature algorithm to use |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2823 and its parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2824 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2825 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2826 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2827 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2828 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2829 pass the string identifying the algorithm or an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2830 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2831 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2832 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2833 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2834 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2835 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2836 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2837 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2838 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2839 <literal>name</literal> is a string, should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2840 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2841 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2842 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2843 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2844 <literal>saltLength</literal> is a long <literal>integer</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2845 that represents the length of the random salt to use, in bytes |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2846 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2847 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2848 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2849 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2850 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2851 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2852 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2853 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2854 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2855 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2856 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2857 <literal>name</literal> is a string, should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2858 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2859 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2860 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2861 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2862 <literal>hash</literal> is an identifier for the digest algorithm to use, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2863 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2864 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2865 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2866 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2867 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2868 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2869 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2870 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2871 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2872 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2873 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2874 pass the string identifying the algorithm or an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2875 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2876 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2877 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2878 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2879 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2880 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2881 <tag-name id="crypto_sign_key"><literal>key</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2882 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2883 is a <link id="cryptokey"><literal>CryptoKey</literal></link> object |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2884 that the key to be used for signing. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2885 If algorithm identifies a public-key cryptosystem, this is the private key. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2886 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2887 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2888 <tag-name id="crypto_sign_data"><literal>data</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2889 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2890 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2891 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2892 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2893 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2894 object that contains the data to be signed |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2895 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2896 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2897 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2898 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2899 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2900 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2901 <tag-name id="crypto_subtle_verify"><literal>сrypto.subtle.verify</literal>(<link id="crypto_verify_alg"><literal>algorithm</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2902 <link id="crypto_verify_key"><literal>key</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2903 <link id="crypto_verify_signature"><literal>signature</literal></link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2904 <link id="crypto_verify_data"><literal>data</literal></link>)</tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2905 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2906 Verifies a digital signature, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2907 returns a <literal>Promise</literal> that fulfills with a boolean value: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2908 <literal>true</literal> if the signature is valid, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2909 otherwise <literal>false</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2910 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2911 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2912 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2913 <tag-name id="crypto_verify_alg"><literal>algorithm</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2914 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2915 is a string or object that specifies the algorithm to use |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2916 and its parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2917 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2918 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2919 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2920 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2921 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2922 pass the string identifying the algorithm or an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2923 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2924 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2925 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2926 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2927 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2928 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2929 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2930 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2931 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2932 <literal>name</literal> is a string, should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2933 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2934 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2935 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2936 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2937 <literal>saltLength</literal> is a long <literal>integer</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2938 that represents the length of the random salt to use, in bytes |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2939 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2940 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2941 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2942 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2943 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2944 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2945 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2946 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2947 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2948 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2949 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2950 <literal>name</literal> is a string, should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2951 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2952 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2953 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2954 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2955 <literal>hash</literal> is an identifier for the digest algorithm to use, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2956 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2957 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2958 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2959 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2960 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2961 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2962 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2963 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2964 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2965 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2966 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2967 pass the string identifying the algorithm or an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2968 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2969 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2970 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2971 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2972 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2973 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2974 <tag-name id="crypto_verify_key"><literal>key</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2975 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2976 is a <link id="cryptokey"><literal>CryptoKey</literal></link> object |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2977 that the key to be used for verifying. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2978 It is the secret key for a symmetric algorithm |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2979 and the public key for a public-key system. |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2980 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2981 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2982 <tag-name id="crypto_verify_signature"><literal>signature</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2983 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2984 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2985 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2986 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2987 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2988 that contains the signature to verify |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2989 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2990 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2991 <tag-name id="crypto_verify_data"><literal>data</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2992 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2993 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2994 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2995 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2996 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2997 object that contains the data whose signature is to be verified |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2998 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2999 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3000 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3001 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3002 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3003 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3004 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3005 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3006 </section> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3007 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3008 |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3009 <section id="cryptokey" name="CryptoKey"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3010 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3011 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3012 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3013 <tr><td><link id="cryptokey_alg"><literal>CryptoKey.algorithm</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3014 <tr><td><link id="cryptokey_extractable"><literal>CryptoKey.extractable</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3015 <tr><td><link id="cryptokey_type"><literal>CryptoKey.type</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3016 <tr><td><link id="cryptokey_usages"><literal>CryptoKey.usages</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3017 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3018 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3019 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3020 <para> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3021 The <literal>CryptoKey</literal> object |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3022 represents a cryptographic <literal>key</literal> obtained |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3023 from one of the <literal>SubtleCrypto</literal> methods: |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3024 <link id="crypto_subtle_generate_key"><literal>сrypto.subtle.generateKey()</literal></link>, |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3025 <link id="crypto_subtle_derive_key"><literal>сrypto.subtle.deriveKey()</literal></link>, |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3026 <link id="crypto_subtle_import_key"><literal>сrypto.subtle.importKey()</literal></link>. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3027 </para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3028 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3029 <para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3030 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3031 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3032 <tag-name id="cryptokey_alg"><literal>CryptoKey.algorithm</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3033 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3034 returns an object describing the algorithm for which this key can be used |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3035 and any associated extra parameters |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3036 (since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>), |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3037 read-only |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3038 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3039 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3040 <tag-name id="cryptokey_extractable"><literal>CryptoKey.extractable</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3041 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3042 a boolean value, <literal>true</literal> if the key can be exported |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3043 (since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>), |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3044 read-only |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3045 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3046 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3047 <tag-name id="cryptokey_type"><literal>CryptoKey.type</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3048 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3049 a string value that indicates which kind of key is represented by the object, |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3050 read-only. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3051 Possible values: |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3052 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3053 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3054 <tag-name><literal>secret</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3055 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3056 This key is a secret key for use with a symmetric algorithm. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3057 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3058 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3059 <tag-name><literal>private</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3060 <tag-desc> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3061 This key is the private half of an asymmetric algorithm's |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3062 <link id="cryptokeypair"><literal>CryptoKeyPair</literal></link> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3063 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3064 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3065 <tag-name><literal>public</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3066 <tag-desc> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3067 This key is the public half of an asymmetric algorithm's |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3068 <link id="cryptokeypair"><literal>CryptoKeyPair</literal></link>. |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3069 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3070 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3071 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3072 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3073 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3074 <tag-name id="cryptokey_usages"><literal>CryptoKey.usages</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3075 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3076 An array of strings indicating what this key can be used for |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3077 (since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>), |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3078 read-only. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3079 Possible array values: |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3080 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3081 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3082 <tag-name><literal>encrypt</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3083 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3084 key for encrypting messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3085 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3086 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3087 <tag-name><literal>decrypt</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3088 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3089 key for decrypting messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3090 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3091 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3092 <tag-name><literal>sign</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3093 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3094 key for signing messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3095 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3096 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3097 <tag-name><literal>verify</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3098 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3099 key for verifying signatures |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3100 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3101 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3102 <tag-name><literal>deriveKey</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3103 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3104 key for deriving a new key |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3105 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3106 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3107 <tag-name><literal>deriveBits</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3108 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3109 key for deriving bits |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3110 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3111 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3112 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3113 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3114 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3115 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3116 </para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3117 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3118 </section> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3119 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3120 |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3121 <section id="cryptokeypair" name="CryptoKeyPair"> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3122 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3123 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3124 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3125 <tr><td><link id="cryptokeypair_privatekey"><literal>CryptoKeyPair.privateKey</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3126 <tr><td><link id="cryptokeypair_publickey"><literal>CryptoKeyPair.publicKey</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3127 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3128 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3129 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3130 <para> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3131 The <literal>CryptoKeyPair</literal> is a dictionary object |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3132 of the <link id="builtin_crypto">WebCrypto API</link> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3133 that represents an asymmetric key pair. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3134 </para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3135 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3136 <para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3137 <list type="tag"> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3138 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3139 <tag-name id="cryptokeypair_privatekey"><literal>CryptoKeyPair.privateKey</literal></tag-name> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3140 <tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3141 A <link id="cryptokey"><literal>CryptoKey</literal></link> object |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3142 representing the private key. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3143 </tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3144 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3145 <tag-name id="cryptokeypair_publickey"><literal>CryptoKeyPair.publicKey</literal></tag-name> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3146 <tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3147 A <link id="cryptokey"><literal>CryptoKey</literal></link> object |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3148 representing the public key. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3149 </tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3150 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3151 </list> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3152 </para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3153 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3154 </section> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3155 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3156 |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3157 <section id="njs" name="njs"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3158 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3159 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3160 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3161 <tr><td><link id="njs_version"><literal>njs.version</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3162 <tr><td><link id="njs_version_number"><literal>njs.version_number</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3163 <tr><td><link id="njs_dump"><literal>njs.dump()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3164 <tr><td><link id="njs_memory_stats"><literal>njs.memoryStats</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3165 <tr><td><link id="njs_on"><literal>njs.on()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3166 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3167 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3168 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3169 <para> |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3170 The <literal>njs</literal> object is a global object |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3171 that represents the current VM instance |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3172 (since <link doc="changes.xml" id="njs0.2.0">0.2.0</link>). |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3173 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3174 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3175 <para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3176 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3177 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3178 <tag-name id="njs_version"><literal>njs.version</literal></tag-name> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3179 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3180 Returns a string with the current version of njs |
2847
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3181 (for example, “0.7.4”). |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3182 </tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3183 |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3184 <tag-name id="njs_version_number"><literal>njs.version_number</literal></tag-name> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3185 <tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3186 Returns a number with the current version of njs. |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3187 For example, “0.7.4” is returned as <literal>0x000704</literal> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3188 (since <link doc="changes.xml" id="njs0.7.4">0.7.4</link>). |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3189 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3190 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3191 <tag-name id="njs_dump"><literal>njs.dump(<value>value</value>)</literal></tag-name> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3192 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3193 Returns the pretty-print string representation for a value. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3194 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3195 |
2904
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3196 <tag-name id="njs_memory_stats"><literal>njs.memoryStats</literal></tag-name> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3197 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3198 Object containing memory statistics for current VM instance |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3199 (since <link doc="changes.xml" id="njs0.7.8">0.7.8</link>). |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3200 <list type="tag"> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3201 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3202 <tag-name><literal>size</literal></tag-name> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3203 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3204 amount of memory in bytes njs memory pool claimed from the operating system. |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3205 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3206 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3207 </list> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3208 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3209 |
2679
8f3e9ff2785f
Corrected syntax of njs.on() and ngx.fetch() in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2670
diff
changeset
|
3210 <tag-name id="njs_on"><literal>njs.on(<value>event</value>, |
8f3e9ff2785f
Corrected syntax of njs.on() and ngx.fetch() in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2670
diff
changeset
|
3211 <value>callback</value>)</literal></tag-name> |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3212 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3213 Registers a callback for the specified VM event |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3214 (since <link doc="changes.xml" id="njs0.5.2">0.5.2</link>). |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3215 An event may be one of the following strings: |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3216 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3217 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3218 <tag-name><literal>exit</literal></tag-name> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3219 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3220 is called before the VM is destroyed. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3221 The callback is called without arguments. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3222 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3223 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3224 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3225 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3226 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3227 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3228 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3229 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3230 </section> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3231 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3232 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3233 <section id="process" name="process"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3234 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3235 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3236 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3237 <tr><td><link id="process_argv"><literal>process.argv</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3238 <tr><td><link id="process_env"><literal>process.env</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3239 <tr><td><link id="process_pid"><literal>process.pid</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3240 <tr><td><link id="process_ppid"><literal>process.ppid</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3241 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3242 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3243 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3244 <para> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3245 The <literal>process</literal> object is a global object |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3246 that provides information about the current process |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3247 (<link doc="changes.xml" id="njs0.3.3">0.3.3</link>). |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3248 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3249 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3250 <para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3251 <list type="tag"> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3252 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3253 <tag-name id="process_argv"><literal>process.argv</literal></tag-name> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3254 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3255 Returns an array that contains the command line arguments |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3256 passed when the current process was launched. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3257 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3258 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3259 <tag-name id="process_env"><literal>process.env</literal></tag-name> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3260 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3261 Returns an object containing the user environment. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3262 <note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3263 By default, nginx removes all environment variables inherited |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3264 from its parent process except the TZ variable. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3265 Use the <link doc="../ngx_core_module.xml" id="env"/> directive |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3266 to preserve some of the inherited variables. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3267 </note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3268 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3269 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3270 <tag-name id="process_pid"><literal>process.pid</literal></tag-name> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3271 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3272 Returns the PID of the current process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3273 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3274 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3275 <tag-name id="process_ppid"><literal>process.ppid</literal></tag-name> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3276 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3277 Returns the PID of the current parent process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3278 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3279 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3280 </list> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3281 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3282 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3283 </section> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3284 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3285 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3286 <section id="string" name="String"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3287 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3288 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3289 By default all strings in njs are Unicode strings. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3290 They correspond to ECMAScript strings that contain Unicode characters. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3291 Before <link doc="changes.xml" id="njs0.8.0">0.8.0</link>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3292 byte strings were also supported. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3293 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3294 |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3295 <section id="byte_string" name="Byte strings"> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3296 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3297 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3298 <note> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3299 Since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3300 the support for byte strings and byte string methods were removed. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3301 When working with byte sequence, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3302 the <link id="buffer">Buffer</link> object |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3303 and <literal>Buffer</literal> properties, such as |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3304 <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3305 <link id="r_raw_variables"><literal>r.rawVariables</literal></link>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3306 should be used. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3307 </note> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3308 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3309 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3310 <para> |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
3311 Byte strings contain a sequence of bytes |
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
3312 and are used to serialize Unicode strings |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3313 to external data and deserialize from external sources. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3314 For example, the <link id="string_toutf8">toUTF8()</link> method serializes |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
3315 a Unicode string to a byte string using UTF-8 encoding: |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3316 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3317 >> '£'.toUTF8().toString('hex') |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
3318 'c2a3' /* C2 A3 is the UTF-8 representation of 00A3 ('£') code point */ |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3319 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3320 The <link id="string_tobytes">toBytes()</link> method serializes |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3321 a Unicode string with code points up to 255 into a byte string, |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3322 otherwise, <literal>null</literal> is returned: |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3323 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3324 >> '£'.toBytes().toString('hex') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
3325 'a3' /* a3 is a byte equal to 00A3 ('£') code point */ |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3326 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3327 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3328 <list type="tag"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3329 |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3330 <tag-name id="string_bytesfrom"><literal>String.bytesFrom(<value>array</value> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3331 | <value>string</value>, <value>encoding</value>)</literal></tag-name> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3332 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3333 The method was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3334 <link doc="changes.xml" id="njs0.4.4">0.4.4</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3335 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3336 The <literal>Buffer.from</literal> method should be used instead: |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3337 <example> |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
3338 >> Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]).toString() |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3339 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3340 |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
3341 >> Buffer.from('YnVmZmVy', 'base64').toString() |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3342 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3343 </example> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3344 Before <link doc="changes.xml" id="njs0.4.4">0.4.4</link>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3345 created a byte string either from an array that contained octets, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3346 or from an encoded string |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3347 (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>), |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3348 the encoding could be |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3349 <literal>hex</literal>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3350 <literal>base64</literal>, and |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3351 <literal>base64url</literal>. |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3352 </tag-desc> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3353 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3354 <tag-name id="string_frombytes"><literal>String.prototype.fromBytes(<value>start</value>[, |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3355 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3356 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3357 the property was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3358 <link doc="changes.xml" id="njs0.7.7">0.7.7</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3359 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3360 Before <link doc="changes.xml" id="njs0.7.7">0.7.7</link>, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3361 returned a new Unicode string from a byte string |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3362 where each byte was replaced with a corresponding Unicode code point. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3363 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3364 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3365 <tag-name id="string_fromutf8"><literal>String.prototype.fromUTF8(<value>start</value>[, |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3366 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3367 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3368 the property was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3369 <link doc="changes.xml" id="njs0.7.7">0.7.7</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3370 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3371 The <link id="textedeoder"><literal>TextDecoder</literal></link> method |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3372 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3373 Before <link doc="changes.xml" id="njs0.7.7">0.7.7</link>, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3374 converted a byte string containing a valid UTF-8 string |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3375 into a Unicode string, |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3376 otherwise <literal>null</literal> was returned. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3377 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3378 |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3379 <tag-name id="string_tobytes"><literal>String.prototype.toBytes(<value>start</value>[, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3380 <value>end</value>])</literal></tag-name> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3381 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3382 the property was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3383 <link doc="changes.xml" id="njs0.7.7">0.7.7</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3384 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3385 Before <link doc="changes.xml" id="njs0.7.7">0.7.7</link>, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3386 serialized a Unicode string to a byte string, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3387 returned <literal>null</literal> if a character larger than 255 was |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3388 found in the string. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3389 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3390 |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3391 <tag-name id="string_tostring"><literal>String.prototype.toString(<value>encoding</value>)</literal></tag-name> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3392 <tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3393 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3394 the property was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3395 <link doc="changes.xml" id="njs0.7.7">0.7.7</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3396 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3397 Before <link doc="changes.xml" id="njs0.7.7">0.7.7</link>, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3398 encoded a string to |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3399 <literal>hex</literal>, |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3400 <literal>base64</literal>, or |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3401 <literal>base64url</literal>: |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3402 <example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3403 >> 'αβγδ'.toString('base64url') |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3404 'zrHOss6zzrQ' |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3405 </example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3406 Before version <link doc="changes.xml" id="njs0.4.3">0.4.3</link>, |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3407 only a <link id="string_tobytes">byte string</link> could be encoded: |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3408 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3409 >> 'αβγδ'.toUTF8().toString('base64url') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
3410 'zrHOss6zzrQ' |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3411 </example> |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3412 </para> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3413 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3414 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3415 <tag-name id="string_toutf8"><literal>String.prototype.toUTF8(<value>start</value>[, |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3416 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3417 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3418 the property was made obsolete in |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3419 <link doc="changes.xml" id="njs0.7.7">0.7.7</link> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3420 and was removed in <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3421 The <link id="textencoder"><literal>TextEncoder</literal></link> method |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3422 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3423 Before <link doc="changes.xml" id="njs0.7.7">0.7.7</link>, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3424 serialized a Unicode string |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3425 to a byte string using UTF-8 encoding: |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3426 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3427 >> 'αβγδ'.toUTF8().length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3428 8 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3429 >> 'αβγδ'.length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3430 4 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3431 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3432 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3433 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3434 </list> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3435 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3436 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3437 </section> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3438 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3439 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3440 |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3441 </section> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3442 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3443 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3444 <section id="webapi" name="web API"> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3445 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3446 |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3447 <section id="textdecoder" name="Text Decoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3448 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3449 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3450 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3451 <tr><td><link id="textdecoder_constructor"><literal>TextDecoder()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3452 <tr><td><link id="textdecoder_encoding"><literal>TextDecoder.prototype.encoding</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3453 <tr><td><link id="textdecoder_fatal"><literal>TextDecoder.prototype.fatal</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3454 <tr><td><link id="textdecoder_ignorebom"><literal>TextDecoder.prototype.ignoreBOM</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3455 <tr><td><link id="textdecoder_decode"><literal>TextDecoder.prototype.decode()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3456 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3457 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3458 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3459 <para> |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3460 The <literal>TextDecoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3461 produces a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3462 from a stream of bytes |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3463 (<link doc="changes.xml" id="njs0.4.3">0.4.3</link>). |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3464 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3465 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3466 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3467 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3468 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3469 <tag-name id="textdecoder_constructor"><literal>TextDecoder([[<value>encoding</value>], |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3470 <value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3471 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3472 Creates a new <literal>TextDecoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3473 for specified <literal>encoding</literal>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3474 currently, only UTF-8 is supported. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3475 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3476 <literal>TextDecoderOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3477 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3478 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3479 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3480 <tag-name><literal>fatal</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3481 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3482 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3483 <link id="textdecoder_decode"><literal>TextDecoder.decode()</literal></link> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3484 must throw the <value>TypeError</value> exception when |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3485 a coding error is found, by default is <literal>false</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3486 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3487 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3488 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3489 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3490 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3491 <tag-name id="textdecoder_encoding"><literal>TextDecoder.prototype.encoding</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3492 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3493 Returns a string with the name of the encoding used by |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3494 <link id="textdecoder"><literal>TextDecoder()</literal></link>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3495 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3496 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3497 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3498 <tag-name id="textdecoder_fatal"><literal>TextDecoder.prototype.fatal</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3499 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3500 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3501 the error mode is fatal, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3502 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3503 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3504 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3505 <tag-name id="textdecoder_ignorebom"><literal>TextDecoder.prototype.ignoreBOM</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3506 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3507 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3508 the byte order marker is ignored, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3509 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3510 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3511 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3512 <tag-name id="textdecoder_decode"><literal>TextDecoder.prototype.decode(<value>buffer</value>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3513 [<value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3514 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3515 Returns a string with the text |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3516 decoded from the <literal>buffer</literal> by |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3517 <link id="textdecoder"><literal>TextDecoder()</literal></link>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3518 The buffer can be <literal>ArrayBuffer</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3519 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3520 <literal>TextDecodeOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3521 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3522 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3523 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3524 <tag-name><literal>stream</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3525 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3526 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3527 additional data will follow in subsequent calls to <literal>decode()</literal>: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3528 <literal>true</literal> if processing the data in chunks, and |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3529 <literal>false</literal> for the final chunk |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3530 or if the data is not chunked. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3531 By default is <literal>false</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3532 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3533 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3534 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3535 <example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3536 >> (new TextDecoder()).decode(new Uint8Array([206,177,206,178])) |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3537 αβ |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3538 </example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3539 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3540 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3541 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3542 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3543 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3544 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3545 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3546 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3547 <section id="textencoder" name="Text Encoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3548 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3549 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3550 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3551 <tr><td><link id="textencoder_constructor"><literal>TextEncoder()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3552 <tr><td><link id="textencoder_encode"><literal>TextEncoder.prototype.encode()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3553 <tr><td><link id="textencoder_encodeinto"><literal>TextEncoder.prototype.encodeInto()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3554 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3555 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3556 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3557 <para> |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3558 The <literal>TextEncoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3559 produces a byte stream with UTF-8 encoding |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3560 from a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3561 (<link doc="changes.xml" id="njs0.4.3">0.4.3</link>). |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3562 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3563 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3564 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3565 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3566 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3567 <tag-name id="textencoder_constructor"><literal>TextEncoder()</literal></tag-name> |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3568 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3569 Returns a newly constructed <literal>TextEncoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3570 that will generate a byte stream with UTF-8 encoding. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3571 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3572 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3573 <tag-name id="textencoder_encode"><literal>TextEncoder.prototype.encode(<value>string</value>)</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3574 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3575 Encodes <literal>string</literal> into a <literal>Uint8Array</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3576 with UTF-8 encoded text. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3577 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3578 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3579 <tag-name id="textencoder_encodeinto"><literal>TextEncoder.prototype.encodeInto(<value>string</value>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3580 <value>uint8Array</value>)</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3581 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3582 Encodes a <literal>string</literal> to UTF-8, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3583 puts the result into destination <literal>Uint8Array</literal>, and |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3584 returns a dictionary object that shows the progress of the encoding. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3585 The dictionary object contains two members: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3586 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3587 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3588 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3589 <tag-name><literal>read</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3590 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3591 the number of UTF-16 units of code from the source <literal>string</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3592 converted to UTF-8 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3593 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3594 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3595 <tag-name><literal>written</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3596 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3597 the number of bytes modified in the destination <literal>Uint8Array</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3598 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3599 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3600 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3601 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3602 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3603 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3604 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3605 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3606 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3607 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3608 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3609 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3610 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3611 <section id="njs_api_timers" name="timers"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3612 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3613 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3614 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3615 <tr><td><link id="cleartimeout"><literal>clearTimeout()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3616 <tr><td><link id="settimeout"><literal>setTimeout()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3617 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3618 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3619 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3620 <para> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3621 <list type="tag"> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3622 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3623 <tag-name id="cleartimeout"><literal>clearTimeout(<value>timeout</value>)</literal></tag-name> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3624 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3625 Cancels a <literal>timeout</literal> object |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3626 created by <link id="settimeout"><literal>setTimeout()</literal></link>. |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3627 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3628 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3629 <tag-name id="settimeout"><literal>setTimeout(<value>function</value>, |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3630 <value>milliseconds</value>[, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3631 <value>argument1</value>, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3632 <value>argumentN</value>])</literal></tag-name> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3633 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3634 Calls a <literal>function</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3635 after a specified number of <literal>milliseconds</literal>. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3636 One or more optional <literal>arguments</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3637 can be passed to the specified function. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3638 Returns a <literal>timeout</literal> object. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3639 <example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3640 function handler(v) |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3641 { |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3642 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3643 } |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3644 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3645 t = setTimeout(handler, 12); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3646 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3647 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3648 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3649 clearTimeout(t); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3650 </example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3651 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3652 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3653 </list> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3654 </para> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3655 |
2873
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3656 <section id="njs_global_functions" name="Global functions"> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3657 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3658 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3659 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3660 <tr><td><link id="atob"><literal>atob()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3661 <tr><td><link id="btoa"><literal>btoa()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3662 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3663 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3664 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3665 <para> |
2873
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3666 <list type="tag"> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3667 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3668 <tag-name id="atob"><literal>atob(<value>encodedData</value>)</literal></tag-name> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3669 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3670 Decodes a string of data which has been encoded |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3671 using <literal>Base64</literal> encoding. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3672 The <literal>encodedData</literal> parameter is a binary string |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3673 that contains Base64-encoded data. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3674 Returns a string that contains decoded data from <literal>encodedData</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3675 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3676 The similar <link id="btoa"><literal>btoa()</literal></link> method |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3677 can be used to encode and transmit data |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3678 which may otherwise cause communication problems, |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3679 then transmit it and use the <literal>atob()</literal> method |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3680 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3681 For example, you can encode, transmit, and decode control characters |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3682 such as ASCII values <literal>0</literal> through <literal>31</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3683 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3684 const encodedData = btoa("text to encode"); // encode a string |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3685 const decodedData = atob(encodedData); // decode the string |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3686 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3687 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3688 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3689 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3690 <tag-name id="btoa"><literal>btoa(<value>stringToEncode</value>)</literal></tag-name> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3691 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3692 Creates a Base64-encoded ASCII string from a binary string. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3693 The <literal>stringToEncode</literal> parameter is a binary string to encode. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3694 Returns an ASCII string containing the Base64 representation of |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3695 <literal>stringToEncode</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3696 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3697 The method can be used to encode data |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3698 which may otherwise cause communication problems, transmit it, |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3699 then use the <link id="atob"><literal>atob()</literal></link> method |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3700 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3701 For example, you can encode control characters |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3702 such as ASCII values <literal>0</literal> through <literal>31</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3703 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3704 const encodedData = btoa("text to encode"); // encode a string |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3705 const decodedData = atob(encodedData); // decode the string |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3706 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3707 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3708 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3709 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3710 </list> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3711 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3712 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3713 </section> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3714 |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3715 </section> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3716 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3717 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3718 <section id="builtin_modules" name="built-in modules"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3719 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3720 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3721 <section id="buffer" name="Buffer"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3722 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3723 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3724 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3725 <tr><td><link id="buffer_alloc"><literal>Buffer.alloc()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3726 <tr><td><link id="buffer_alloc_unsafe"><literal>Buffer.allocUnsafe()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3727 <tr><td><link id="buffer_bytelength"><literal>Buffer.byteLength()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3728 <tr><td><link id="buffer_compare"><literal>Buffer.compare()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3729 <tr><td><link id="buffer_concat"><literal>Buffer.concat()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3730 <tr><td><link id="buffer_from_array"><literal>Buffer.from(array)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3731 <tr><td><link id="buffer_from_arraybuffer"><literal>Buffer.from(arrayBuffer)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3732 <tr><td><link id="buffer_from_buffer"><literal>Buffer.from(buffer)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3733 <tr><td><link id="buffer_from_object"><literal>Buffer.from(object)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3734 <tr><td><link id="buffer_from_string"><literal>Buffer.from(string)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3735 <tr><td><link id="buffer_is_buffer"><literal>Buffer.isBuffer()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3736 <tr><td><link id="buffer_is_encoding"><literal>Buffer.isEncoding()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3737 <tr><td><link id="buf_index"><literal>buffer[]</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3738 <tr><td><link id="buf_buffer"><literal>buf.buffer</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3739 <tr><td><link id="buf_byte_offset"><literal>buf.byteOffset</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3740 <tr><td><link id="buf_compare"><literal>buf.compare()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3741 <tr><td><link id="buf_copy"><literal>buf.copy()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3742 <tr><td><link id="buf_equals"><literal>buf.equals()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3743 <tr><td><link id="buf_fill"><literal>buf.fill()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3744 <tr><td><link id="buf_includes"><literal>buf.includes()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3745 <tr><td><link id="buf_indexof"><literal>buf.indexOf()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3746 <tr><td><link id="buf_lastindexof"><literal>buf.lastIndexOf()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3747 <tr><td><link id="buf_length"><literal>buf.length</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3748 <tr><td><link id="buf_readintbe"><literal>buf.readIntBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3749 <tr><td><link id="buf_readintle"><literal>buf.readIntLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3750 <tr><td><link id="buf_readuintbe"><literal>buf.readUIntBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3751 <tr><td><link id="buf_readuintle"><literal>buf.readUIntLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3752 <tr><td><link id="buf_readdobulebe"><literal>buf.readDoubleBE</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3753 <tr><td><link id="buf_readdobulele"><literal>buf.readDoubleLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3754 <tr><td><link id="buf_readfloatbe"><literal>buf.readFloatBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3755 <tr><td><link id="buf_readfloatle"><literal>buf.readFloatLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3756 <tr><td><link id="buf_subarray"><literal>buf.subarray()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3757 <tr><td><link id="buf_slice"><literal>buf.slice()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3758 <tr><td><link id="buf_swap16"><literal>buf.swap16()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3759 <tr><td><link id="buf_swap32"><literal>buf.swap32()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3760 <tr><td><link id="buf_swap64"><literal>buf.swap64()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3761 <tr><td><link id="buf_tojson"><literal>buf.toJSON()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3762 <tr><td><link id="buf_tostring"><literal>buf.toString()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3763 <tr><td><link id="buf_write"><literal>buf.write()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3764 <tr><td><link id="buf_writeintbe"><literal>buf.writeIntBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3765 <tr><td><link id="buf_writeintle"><literal>buf.writeIntLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3766 <tr><td><link id="buf_writeuintbe"><literal>buf.writeUIntBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3767 <tr><td><link id="buf_writeuintle"><literal>buf.writeUIntLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3768 <tr><td><link id="buf_writedoublebe"><literal>buf.writeDoubleBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3769 <tr><td><link id="buf_writedoublele"><literal>buf.writeDoubleLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3770 <tr><td><link id="buf_writefloatbe"><literal>buf.writeFloatBE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3771 <tr><td><link id="buf_writefloatle"><literal>buf.writeFloatLE()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3772 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3773 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3774 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3775 <para> |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3776 <list type="tag"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3777 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3778 <tag-name id="buffer_alloc"><literal>Buffer.alloc(<value>size</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3779 <value>fill</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3780 <value>encoding</value>]]))</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3781 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3782 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3783 Allocates a new Buffer of a specified <value>size</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3784 If <value>fill</value> is not specified, the Buffer will be zero-filled. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3785 If <value>fill</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3786 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3787 <link id="buf_fill"><literal>buf.fill(fill)</literal></link>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3788 If <value>fill</value> and <value>encoding</value> are specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3789 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3790 <link id="buf_fill"><literal>buf.fill(fill, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3791 encoding)</literal></link>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3792 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3793 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3794 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3795 The <value>fill</value> parameter may be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3796 <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3797 <value>Buffer</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3798 <value>Uint8Array</value>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3799 <value>integer</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3800 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3801 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3802 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3803 <tag-name id="buffer_alloc_unsafe"><literal>Buffer.allocUnsafe(<value>size</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3804 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3805 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3806 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3807 <link id="buffer_alloc"><literal>Buffer.alloc()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3808 with the difference that the memory allocated for the buffer is not initialized, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3809 the contents of the new buffer is unknown and may contain sensitive data. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3810 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3811 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3812 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3813 <tag-name id="buffer_bytelength"><literal>Buffer.byteLength(<value>value</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3814 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3815 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3816 Returns the byte length of a specified value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3817 when encoded using <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3818 The value can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3819 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3820 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3821 <literal>TypedArray</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3822 <literal>DataView</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3823 <literal>ArrayBuffer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3824 If the value is a <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3825 the <literal>encoding</literal> parameter is its encoding, can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3826 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3827 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3828 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3829 <value>base64url</value>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3830 by default is <value>utf8</value>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3831 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3832 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3833 <tag-name id="buffer_compare"><literal>Buffer.compare(<value>buffer1</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3834 <value>buffer2</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3835 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3836 Compares <value>buffer1</value> with <value>buffer2</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3837 when sorting arrays of Buffer instances. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3838 Returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3839 <literal>0</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3840 <value>buffer1</value> is the same as <value>buffer2</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3841 <literal>1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3842 <value>buffer2</value> should come before <value>buffer1</value> when sorted, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3843 <literal>-1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3844 <value>buffer2</value> should come after <value>buffer1</value> when sorted. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3845 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3846 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3847 <tag-name id="buffer_concat"><literal>Buffer.concat(<value>list</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3848 <value>totalLength</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3849 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3850 Returns a new Buffer |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3851 which is the result of concatenating all the Buffer instances in the list. |
2735
ff357b676c2e
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2716
diff
changeset
|
3852 If there are no items in the list or the total length is 0, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3853 a new zero-length Buffer is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3854 If <value>totalLength</value> is not specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3855 it is calculated from the Buffer instances in list by adding their lengths. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3856 If <value>totalLength</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3857 it is coerced to an unsigned integer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3858 If the combined length of the Buffers in list exceeds |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3859 <value>totalLength</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3860 the result is truncated to <value>totalLength</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3861 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3862 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3863 <tag-name id="buffer_from_array"><literal>Buffer.from(<value>array</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3864 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3865 Allocates a new Buffer using an array of bytes |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3866 in the range <literal>0</literal> – <literal>255</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3867 Array entries outside that range will be truncated. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3868 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3869 |
2612
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3870 <tag-name id="buffer_from_arraybuffer"><literal>Buffer.from(<value>arrayBuffer</value>, |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3871 <value>byteOffset</value>[, |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3872 <value>length</value>]])</literal></tag-name> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3873 <tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3874 Creates a view of the <value>ArrayBuffer</value> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3875 without copying the underlying memory. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3876 The optional <value>byteOffset</value> and <value>length</value> arguments |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3877 specify a memory range within the <value>arrayBuffer</value> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3878 that will be shared by the Buffer. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3879 </tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3880 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3881 <tag-name id="buffer_from_buffer"><literal>Buffer.from(<value>buffer</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3882 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3883 Copies the passed buffer data onto a new Buffer instance. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3884 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3885 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3886 <tag-name id="buffer_from_object"><literal>Buffer.from(<value>object</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3887 <value>offsetOrEncoding</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3888 <value>length</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3889 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3890 For objects whose <literal>valueOf()</literal> function |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3891 returns a value not strictly equal to object, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3892 returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3893 <literal>Buffer.from(object.valueOf()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3894 <literal>offsetOrEncoding</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3895 <literal>length</literal>). |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3896 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3897 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3898 <tag-name id="buffer_from_string"><literal>Buffer.from(<value>string</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3899 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3900 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3901 Creates a new Buffer with a <value>string</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3902 The <value>encoding</value> parameter identifies the character encoding |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3903 to be used when converting a string into bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3904 The encoding can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3905 <literal>utf8</literal>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3906 <literal>hex</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3907 <literal>base64</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3908 <literal>base64url</literal>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3909 by default is <literal>utf8</literal>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3910 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3911 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3912 <tag-name id="buffer_is_buffer"><literal>Buffer.isBuffer(<value>object</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3913 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3914 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3915 returns <literal>true</literal> if <value>object</value> is a Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3916 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3917 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3918 <tag-name id="buffer_is_encoding"><literal>Buffer.isEncoding(<value>encoding</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3919 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3920 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3921 returns <literal>true</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3922 if encoding is the name of a supported character encoding. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3923 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3924 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3925 <tag-name id="buf_index"><literal>buffer[<value>index</value>]</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3926 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3927 The index operator that can be used to get and set the octet |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3928 at position <literal>index</literal> in <literal>buffer</literal>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3929 The values refer to individual bytes, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3930 so the legal value range is between 0 and 255 (decimal). |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3931 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3932 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3933 <tag-name id="buf_buffer"><literal>buf.buffer</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3934 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3935 The underlying <literal>ArrayBuffer</literal> object |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3936 based on which this Buffer object is created. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3937 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3938 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3939 <tag-name id="buf_byte_offset"><literal>buf.byteOffset</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3940 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3941 An integer, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3942 specifying the <literal>byteOffset</literal> of the Buffers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3943 underlying <literal>ArrayBuffer</literal> object. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3944 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3945 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3946 <tag-name id="buf_compare"><literal>buf.compare(<value>target</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3947 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3948 <value>targetEnd</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3949 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3950 <value>sourceEnd</value>]]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3951 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3952 Compares buffer with <value>target</value> and returns a number |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3953 indicating whether buffer comes before, after, or is the same |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3954 as <value>target</value> in sort order. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3955 Comparison is based on the actual sequence of bytes in each Buffer. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3956 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3957 the offset within <value>target</value> at which to begin comparison, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3958 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3959 The <literal>targetEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3960 the offset within <value>target</value> at which to end comparison, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3961 by default is <literal>target.length</literal>. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3962 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3963 the offset within buffer at which to begin comparison, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3964 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3965 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3966 the offset within buffer at which to end comparison (not inclusive), |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3967 by default is <literal>buf.length</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3968 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3969 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3970 <tag-name id="buf_copy"><literal>buf.copy(<value>target</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3971 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3972 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3973 <value>sourceEnd</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3974 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3975 Copies data from a region of buffer to a region in <value>target</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3976 even if the target memory region overlaps with buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3977 The <literal>target</literal> parameter is a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3978 <value>Buffer</value> or <value>Uint8Array</value> to copy into. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3979 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3980 <para> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3981 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3982 the offset within target at which to begin writing, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3983 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3984 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3985 the offset within buffer from which to begin copying, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3986 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3987 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3988 the offset within buffer at which to stop copying (not inclusive) |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3989 by default is <value>buf.length</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3990 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3991 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3992 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3993 <tag-name id="buf_equals"><literal>buf.equals(<value>otherBuffer</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3994 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3995 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3996 returns <literal>true</literal> if both Buffer and <value>otherBuffer</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3997 have exactly the same bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3998 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3999 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4000 <tag-name id="buf_fill"><literal>buf.fill(<value>value</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4001 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4002 <value>end</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4003 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4004 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4005 Fills the Buffer with the specified <value>value</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4006 If the <value>offset</value> and <value>end</value> are not specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4007 the entire Buffer will be filled. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4008 The <value>value</value> is coerced to <value>uint32</value> if it is not a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4009 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4010 <literal>Buffer</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4011 <literal>integer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4012 If the resulting integer is greater than 255, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4013 the Buffer will be filled with <value>value</value> and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4014 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4015 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4016 <tag-name id="buf_includes"><literal>buf.includes(<value>value</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4017 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4018 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4019 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4020 Equivalent to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4021 <link id="buf_indexof"><literal>buf.indexOf()</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4022 <literal>!== -1</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4023 returns <literal>true</literal> if the <value>value</value> was found |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4024 in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4025 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4026 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4027 <tag-name id="buf_indexof"><literal>buf.indexOf(<value>value</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4028 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4029 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4030 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4031 Returns an integer which is the index of the first occurrence of |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4032 <value>value</value> in Buffer, or <value>-1</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4033 if Buffer does not contain value. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4034 The <value>value</value> can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4035 <literal>string</literal> with specified <value>encoding</value> |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4036 (by default <value>utf8</value>), |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4037 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4038 <literal>Unit8Array</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4039 or a number between 0 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4040 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4041 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4042 <tag-name id="buf_lastindexof"><literal>buf.lastIndexOf(<value>value</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4043 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4044 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4045 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4046 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4047 <link id="buf_indexof"><literal>buf.indexOf()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4048 except the last occurrence of the <value>value</value> is found |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4049 instead of the first occurrence. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4050 The <value>value</value> can be a string, Buffer, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4051 integer between 1 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4052 If the <value>value</value> is an empty string or empty Buffer, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4053 <literal>byteOffset</literal> will be returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4054 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4055 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4056 <tag-name id="buf_length"><literal>buf.length</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4057 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4058 Returns the number of bytes in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4059 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4060 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4061 <tag-name id="buf_readintbe"><literal>buf.readIntBE(<value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4062 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4063 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4064 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4065 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4066 and interprets the result as a big-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4067 two's complement signed value supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4068 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4069 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4070 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4071 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4072 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4073 <literal>buf.readInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4074 <literal>buf.readInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4075 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4076 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4077 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4078 <tag-name id="buf_readintle"><literal>buf.readIntLE(<value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4079 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4080 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4081 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4082 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4083 and interprets the result as a little-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4084 two's complement signed value supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4085 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4086 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4087 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4088 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4089 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4090 <literal>buf.readInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4091 <literal>buf.readInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4092 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4093 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4094 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4095 <tag-name id="buf_readuintbe"><literal>buf.readUIntBE(<value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4096 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4097 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4098 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4099 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4100 and interprets the result as a big-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4101 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4102 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4103 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4104 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4105 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4106 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4107 <literal>buf.readUInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4108 <literal>buf.readUInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4109 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4110 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4111 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4112 <tag-name id="buf_readuintle"><literal>buf.readUIntLE(<value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4113 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4114 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4115 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4116 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4117 and interprets the result as a little-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4118 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4119 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4120 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4121 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4122 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4123 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4124 <literal>buf.readUInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4125 <literal>buf.readUInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4126 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4127 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4128 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4129 <tag-name id="buf_readdobulebe"><literal>buf.readDoubleBE</literal>([<value>offset</value>])</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4130 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4131 Reads a 64-bit, big-endian double from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4132 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4133 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4134 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4135 <tag-name id="buf_readdobulele"><literal>buf.readDoubleLE</literal>([<value>offset</value>])</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4136 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4137 Reads a 64-bit, little-endian double from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4138 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4139 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4140 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4141 <tag-name id="buf_readfloatbe"><literal>buf.readFloatBE</literal>([<value>offset</value>])</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4142 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4143 Reads a 32-bit, big-endian float from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4144 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4145 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4146 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4147 <tag-name id="buf_readfloatle"><literal>buf.readFloatLE</literal>([<value>offset</value>])</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4148 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4149 Reads a 32-bit, little-endian float from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4150 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4151 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4152 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4153 <tag-name id="buf_subarray"><literal>buf.subarray([<value>start</value>[, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4154 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4155 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4156 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4157 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4158 but offset and cropped by |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4159 <value>start</value> and <value>end</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4160 If <value>end</value> is greater than |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4161 <link id="buf_length"><literal>buf.length</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4162 the same result as that of end equal to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4163 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4164 is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4165 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4166 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4167 <tag-name id="buf_slice"><literal>buf.slice([<value>start</value>[, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4168 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4169 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4170 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4171 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4172 but offset and cropped by the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4173 <value>start</value> and <value>end</value> values. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4174 The method is not compatible with the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4175 <literal>Uint8Array.prototype.slice()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4176 which is a superclass of Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4177 To copy the slice, use |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4178 <literal>Uint8Array.prototype.slice()</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4179 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4180 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4181 <tag-name id="buf_swap16"><literal>buf.swap16</literal>()</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4182 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4183 Interprets <literal>buf</literal> as an array of unsigned 16-bit numbers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4184 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4185 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4186 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4187 is not a multiple of 2. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4188 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4189 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4190 <tag-name id="buf_swap32"><literal>buf.swap32</literal>()</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4191 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4192 Interprets <literal>buf</literal> as an array of unsigned 32-bit numbers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4193 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4194 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4195 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4196 is not a multiple of 4. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4197 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4198 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4199 <tag-name id="buf_swap64"><literal>buf.swap64</literal>()</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4200 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4201 Interprets <literal>buf</literal> as an array of 64-bit numbers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4202 and swaps byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4203 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4204 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4205 is not a multiple of 8. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4206 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4207 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4208 <tag-name id="buf_tojson"><literal>buf.toJSON</literal>()</tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4209 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4210 Returns a JSON representation of <literal>buf.</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4211 <literal>JSON.stringify()</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4212 implicitly calls this function when stringifying a Buffer instance. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4213 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4214 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4215 <tag-name id="buf_tostring"><literal>buf.toString([<value>encoding</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4216 <value>start</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4217 <value>end</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4218 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4219 Decodes <literal>buf</literal> to a string |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4220 according to the specified character <value>encoding</value> |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4221 which can be <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4222 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4223 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4224 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4225 The <value>start</value> and <value>end</value> parameters |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4226 may be passed to decode only a subset of Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4227 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4228 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4229 <tag-name id="buf_write"><literal>buf.write(<value>string</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4230 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4231 <value>length</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4232 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4233 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4234 Writes a <value>string</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4235 at <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4236 according to the character <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4237 The <value>length</value> parameter is the number of bytes to write. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4238 If Buffer did not contain enough space to fit the entire string, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4239 only part of string will be written, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4240 however, partially encoded characters will not be written. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4241 The <value>encoding</value> can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4242 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4243 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4244 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4245 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4246 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4247 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4248 <tag-name id="buf_writeintbe"><literal>buf.writeIntBE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4249 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4250 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4251 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4252 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4253 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4254 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4255 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4256 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4257 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4258 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4259 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4260 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4261 <literal>buf.writeInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4262 <literal>buf.writeInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4263 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4264 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4265 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4266 <tag-name id="buf_writeintle"><literal>buf.writeIntLE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4267 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4268 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4269 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4270 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4271 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4272 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4273 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4274 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4275 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4276 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4277 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4278 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4279 <literal>buf.writeInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4280 <literal>buf.writeInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4281 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4282 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4283 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4284 <tag-name id="buf_writeuintbe"><literal>buf.writeUIntBE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4285 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4286 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4287 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4288 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4289 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4290 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4291 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4292 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4293 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4294 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4295 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4296 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4297 <literal>buf.writeUInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4298 <literal>buf.writeUInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4299 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4300 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4301 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4302 <tag-name id="buf_writeuintle"><literal>buf.writeUIntLE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4303 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4304 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4305 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4306 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4307 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4308 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4309 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4310 The <value>byteLength</value> parameter is an integer between 1 and 6 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4311 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4312 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4313 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4314 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4315 <literal>buf.writeUInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4316 <literal>buf.writeUInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4317 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4318 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4319 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4320 <tag-name id="buf_writedoublebe"><literal>buf.writeDoubleBE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4321 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4322 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4323 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4324 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4325 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4326 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4327 <tag-name id="buf_writedoublele"><literal>buf.writeDoubleLE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4328 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4329 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4330 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4331 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4332 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4333 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4334 <tag-name id="buf_writefloatbe"><literal>buf.writeFloatBE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4335 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4336 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4337 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4338 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4339 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4340 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4341 <tag-name id="buf_writefloatle"><literal>buf.writeFloatLE(<value>value</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4342 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4343 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4344 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4345 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4346 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4347 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4348 </list> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4349 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4350 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4351 </section> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4352 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4353 |
2177 | 4354 <section id="crypto" name="Crypto"> |
4355 | |
4356 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4357 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4358 <tr><td><link id="crypto_createhash"><literal>crypto.createHash()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4359 <tr><td><link id="crypto_createhmac"><literal>crypto.createHmac()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4360 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4361 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4362 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4363 <para> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4364 <note> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4365 Since <link doc="changes.xml" id="njs0.7.0">0.7.0</link>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4366 extended crypto API is available as a global |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4367 <link id="builtin_crypto">crypto</link> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4368 </note> |
2177 | 4369 The Crypto module provides cryptographic functionality support. |
4370 The Crypto module object is returned by <literal>require('crypto')</literal>. | |
4371 </para> | |
4372 | |
4373 <para> | |
4374 <list type="tag"> | |
4375 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
4376 <tag-name id="crypto_createhash"><literal>crypto.createHash(<value>algorithm</value>)</literal></tag-name> |
2177 | 4377 <tag-desc> |
4378 Creates and returns a <link id="crypto_hash">Hash</link> object | |
4379 that can be used to generate hash digests | |
4380 using the given <value>algorithm</value>. | |
2496
9dddac1420fe
Fixed typo in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2484
diff
changeset
|
4381 The algorithm can be |
2177 | 4382 <literal>md5</literal>, |
4383 <literal>sha1</literal>, and | |
4384 <literal>sha256</literal>. | |
4385 </tag-desc> | |
4386 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
4387 <tag-name id="crypto_createhmac"><literal>crypto.createHmac(<value>algorithm</value>, |
2177 | 4388 <value>secret key</value>)</literal></tag-name> |
4389 <tag-desc> | |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
4390 Creates and returns an <link id="crypto_hmac">HMAC</link> object that uses |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
4391 the given <value>algorithm</value> and <value>secret key</value>. |
2496
9dddac1420fe
Fixed typo in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2484
diff
changeset
|
4392 The algorithm can be |
2177 | 4393 <literal>md5</literal>, |
4394 <literal>sha1</literal>, and | |
4395 <literal>sha256</literal>. | |
4396 </tag-desc> | |
4397 | |
4398 </list> | |
4399 </para> | |
4400 | |
4401 | |
4402 <section id="crypto_hash" name="Hash"> | |
4403 | |
4404 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4405 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4406 <tr><td><link id="crypto_hash_update"><literal>hash.update()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4407 <tr><td><link id="crypto_hash_digest"><literal>hash.digest()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4408 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4409 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4410 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4411 <para> |
2177 | 4412 <list type="tag"> |
4413 | |
2601 | 4414 <tag-name id="crypto_hash_update"><literal>hash.update(<value>data</value>)</literal></tag-name> |
2177 | 4415 <tag-desc> |
4416 Updates the hash content with the given <value>data</value>. | |
4417 </tag-desc> | |
4418 | |
2601 | 4419 <tag-name id="crypto_hash_digest"><literal>hash.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 4420 <tag-desc> |
4421 Calculates the digest of all of the data passed using | |
4422 <literal>hash.update()</literal>. | |
4423 The encoding can be | |
4424 <literal>hex</literal>, | |
4425 <literal>base64</literal>, and | |
4426 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4427 If encoding is not provided, a Buffer object |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4428 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>) is returned. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4429 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4430 Before version (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>), |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4431 a byte string was returned instead of a Buffer object. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4432 </note> |
2177 | 4433 </tag-desc> |
4434 | |
2952
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4435 <tag-name id="crypto_hash_copy"><literal>hash.copy()</literal></tag-name> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4436 <tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4437 Makes a copy of the current state of the hash |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4438 (since <link doc="changes.xml" id="njs0.7.12">0.7.12</link>). |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4439 </tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4440 |
2177 | 4441 </list> |
4442 </para> | |
4443 | |
4444 <para> | |
4445 <example> | |
4446 >> var cr = require('crypto') | |
4447 undefined | |
4448 | |
4449 >> cr.createHash('sha1').update('A').update('B').digest('base64url') | |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
4450 'BtlFlCqiamG-GMPiK_GbvKjdK10' |
2177 | 4451 </example> |
4452 </para> | |
4453 | |
4454 </section> | |
4455 | |
4456 | |
4457 <section id="crypto_hmac" name="HMAC"> | |
4458 | |
4459 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4460 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4461 <tr><td><link id="crypto_hmac_update"><literal>hmac.update()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4462 <tr><td><link id="crypto_hmac_digest"><literal>hmac.digest()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4463 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4464 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4465 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4466 <para> |
2177 | 4467 <list type="tag"> |
4468 | |
2601 | 4469 <tag-name id="crypto_hmac_update"><literal>hmac.update(<value>data</value>)</literal></tag-name> |
2177 | 4470 <tag-desc> |
4471 Updates the HMAC content with the given <value>data</value>. | |
4472 </tag-desc> | |
4473 | |
2601 | 4474 <tag-name id="crypto_hmac_digest"><literal>hmac.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 4475 <tag-desc> |
4476 Calculates the HMAC digest of all of the data passed using | |
4477 <literal>hmac.update()</literal>. | |
4478 The encoding can be | |
4479 <literal>hex</literal>, | |
4480 <literal>base64</literal>, and | |
4481 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4482 If encoding is not provided, a Buffer object |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4483 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>) is returned. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4484 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4485 Before version <link doc="changes.xml" id="njs0.4.4">0.4.4</link>, |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4486 a byte string was returned instead of a Buffer object. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4487 </note> |
2177 | 4488 </tag-desc> |
4489 </list> | |
4490 </para> | |
4491 | |
4492 <para> | |
4493 <example> | |
4494 >> var cr = require('crypto') | |
4495 undefined | |
4496 | |
4497 >> cr.createHmac('sha1', 'secret.key').update('AB').digest('base64url') | |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
4498 'Oglm93xn23_MkiaEq_e9u8zk374' |
2177 | 4499 </example> |
4500 </para> | |
4501 | |
4502 </section> | |
4503 | |
4504 </section> | |
4505 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4506 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4507 <section id="njs_api_fs" name="File System"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4508 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4509 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4510 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4511 <tr><td><link id="fs_accesssync"><literal>fs.accessSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4512 <tr><td><link id="fs_appendfilesync"><literal>fs.appendFileSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4513 <tr><td><link id="fs_fstatsync"><literal>fs.fstatSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4514 <tr><td><link id="fs_lstatsync"><literal>fs.lstatSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4515 <tr><td><link id="fs_mkdirsync"><literal>fs.mkdirSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4516 <tr><td><link id="fs_opensync"><literal>fs.openSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4517 <tr><td><link id="fs_promises_open"><literal>fs.promises.open()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4518 <tr><td><link id="fs_readsync"><literal>fs.readSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4519 <tr><td><link id="fs_readdirsync"><literal>fs.readdirSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4520 <tr><td><link id="fs_readfilesync"><literal>fs.readFileSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4521 <tr><td><link id="fs_realpathsync"><literal>fs.realpathSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4522 <tr><td><link id="fs_renamesync"><literal>fs.renameSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4523 <tr><td><link id="fs_rmdirsync"><literal>fs.rmdirSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4524 <tr><td><link id="fs_statsync"><literal>fs.statSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4525 <tr><td><link id="fs_symlinksync"><literal>fs.symlinkSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4526 <tr><td><link id="fs_writesync_buf"><literal>fs.writeSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4527 <tr><td><link id="fs_writesync_str"><literal>fs.writeSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4528 <tr><td><link id="fs_unlinksync"><literal>fs.unlinkSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4529 <tr><td><link id="fs_writefilesync"><literal>fs.writeFileSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4530 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4531 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4532 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4533 <para> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4534 The File System module provides operations with files. |
2507 | 4535 </para> |
4536 | |
4537 <para> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4538 The module object is returned by <literal>require('fs')</literal>. |
2508
d3d5b67a1462
Language fixes in njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2507
diff
changeset
|
4539 Since <link doc="changes.xml" id="njs0.3.9">0.3.9</link>, |
d3d5b67a1462
Language fixes in njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2507
diff
changeset
|
4540 promissified versions of file system methods are available through |
2507 | 4541 <literal>require('fs').promises</literal> object: |
4542 <example> | |
4543 > var fs = require('fs').promises; | |
4544 undefined | |
4545 > fs.readFile("/file/path").then((data)=>console.log(data)) | |
4546 <file data> | |
4547 </example> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4548 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4549 |
2507 | 4550 <tag-name id="fs_accesssync"><literal>accessSync(<value>path</value>[, |
4551 <value>mode</value>])</literal></tag-name> | |
4552 <tag-desc> | |
4553 Synchronously tests permissions for a file or directory | |
4554 specified in the <literal>path</literal> | |
4555 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
4556 If the check fails, an error will be returned, | |
4557 otherwise, the method will return undefined. | |
4558 <list type="tag"> | |
4559 | |
4560 <tag-name><literal>mode</literal></tag-name> | |
4561 <tag-desc> | |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4562 an optional integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4563 that specifies the accessibility checks to be performed, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4564 by default is <link id="access_const"><literal>fs.constants.F_OK</literal></link> |
2507 | 4565 <example> |
4566 try { | |
4567 fs.accessSync('/file/path', fs.constants.R_OK | fs.constants.W_OK); | |
4568 console.log('has access'); | |
4569 } catch (e) { | |
4570 console.log('no access');) | |
4571 } | |
4572 </example> | |
4573 </tag-desc> | |
4574 | |
4575 </list> | |
4576 </tag-desc> | |
4577 | |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4578 <tag-name id="fs_appendfilesync"><literal>appendFileSync(<value>filename</value>, |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4579 <value>data</value>[, <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4580 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4581 Synchronously appends specified <literal>data</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4582 to a file with provided <literal>filename</literal>. |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4583 The <literal>data</literal> is expected to be a string |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4584 or a Buffer object (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>). |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4585 If the file does not exist, it will be created. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4586 The <literal>options</literal> parameter is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4587 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4588 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4589 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4590 <tag-name><literal>mode</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4591 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4592 mode option, by default is <literal>0o666</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4593 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4594 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4595 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4596 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4597 file system <link id="njs_api_fs_flags">flag</link>, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4598 by default is <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4599 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4600 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4601 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4602 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4603 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4604 <tag-name id="fs_fstatsync"><literal>fstatSync(<value>fd</value>)</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4605 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4606 Retrieves the <link id="fs_stats"><literal>fs.Stats</literal></link> object |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4607 for the file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4608 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4609 The <literal>fd</literal> parameter is an integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4610 representing the file descriptor used by the method. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4611 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4612 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4613 <tag-name id="fs_lstatsync"><literal>lstatSync(<value>path</value>[, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4614 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4615 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4616 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4617 the <link id="fs_stats"><literal>fs.Stats</literal></link> object |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4618 for the symbolic link referred to by <literal>path</literal> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4619 (<link doc="changes.xml" id="njs0.7.1">0.7.1</link>). |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4620 The <literal>options</literal> parameter is expected to be |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4621 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4622 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4623 <tag-name><literal>throwIfNoEntry</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4624 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4625 a boolean value which indicates |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4626 whether an exception is thrown if no file system entry exists, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4627 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4628 by default is <literal>false</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4629 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4630 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4631 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4632 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4633 <tag-name id="fs_mkdirsync"><literal>mkdirSync(<value>path</value>[, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4634 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4635 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4636 Synchronously creates a directory at the specified <literal>path</literal> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4637 (<link doc="changes.xml" id="njs0.4.2">0.4.2</link>). |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4638 The <literal>options</literal> parameter is expected to be an |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4639 <literal>integer</literal> that specifies |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4640 the <link id="fs_mkdirsync_mode">mode</link>, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4641 or an object with the following keys: |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4642 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4643 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4644 <tag-name id="fs_mkdirsync_mode"><literal>mode</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4645 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4646 mode option, by default is <literal>0o777</literal>. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4647 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4648 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4649 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4650 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4651 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4652 <tag-name id="fs_opensync"><literal>openSync(<value>path</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4653 <value>flags</value>[, <value>mode</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4654 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4655 Returns an integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4656 representing the file descriptor for the opened file <literal>path</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4657 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4658 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4659 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4660 <tag-name><literal>flags</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4661 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4662 file system <link id="njs_api_fs_flags">flag</link>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4663 by default is <literal>r</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4664 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4665 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4666 <tag-name><literal>mode</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4667 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4668 mode option, by default is <literal>0o666</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4669 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4670 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4671 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4672 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4673 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4674 <tag-name id="fs_promises_open"><literal>promises.open(<value>path</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4675 <value>flags</value>[, <value>mode</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4676 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4677 Returns a <link id="fs_filehandle"><literal>FileHandle</literal></link> object |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4678 representing the opened file <literal>path</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4679 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4680 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4681 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4682 <tag-name><literal>flags</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4683 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4684 file system <link id="njs_api_fs_flags">flag</link>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4685 by default is <literal>r</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4686 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4687 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4688 <tag-name><literal>mode</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4689 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4690 mode option, by default is <literal>0o666</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4691 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4692 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4693 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4694 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4695 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4696 <tag-name id="fs_readsync"><literal>readSync(<value>fd</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4697 <value>buffer</value>, <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4698 <value>length</value>[, <value>position</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4699 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4700 Reads the content of a file path using file descriptor <literal>fd</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4701 returns the number of bytes read |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4702 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4703 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4704 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4705 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4706 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4707 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4708 the <literal>buffer</literal> value can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4709 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4710 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4711 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4712 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4713 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4714 <tag-name><literal>offset</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4715 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4716 is an <literal>integer</literal> representing |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4717 the position in buffer to write the data to |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4718 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4719 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4720 <tag-name><literal>length</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4721 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4722 is an <literal>integer</literal> representing |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4723 the number of bytes to read |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4724 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4725 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4726 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4727 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4728 specifies where to begin reading from in the file, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4729 the value can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4730 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4731 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4732 by default is <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4733 If <literal>position</literal> is <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4734 data will be read from the current file position, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4735 and the file position will be updated. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4736 If position is an <literal>integer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4737 the file position will be unchanged |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4738 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4739 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4740 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4741 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4742 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4743 <tag-name id="fs_readdirsync"><literal>readdirSync(<value>path</value>[, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4744 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4745 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4746 Synchronously reads the contents of a directory |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4747 at the specified <literal>path</literal> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4748 (<link doc="changes.xml" id="njs0.4.2">0.4.2</link>). |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4749 The <literal>options</literal> parameter is expected to be |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4750 a string that specifies <link id="fs_readdirsync_encoding">encoding</link> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4751 or an object with the following keys: |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4752 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4753 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4754 <tag-name id="fs_readdirsync_encoding"><literal>encoding</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4755 <tag-desc> |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4756 encoding, by default is <literal>utf8</literal>. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4757 The encoding can be <literal>utf8</literal> and <literal>buffer</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4758 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>). |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4759 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4760 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4761 <tag-name id="fs_readdirsync_withfiletypes"><literal>withFileTypes</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4762 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4763 if set to <literal>true</literal>, the files array will contain |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4764 <link id="fs_dirent"><literal>fs.Dirent</literal></link> objects, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4765 by default is <literal>false</literal>. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4766 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4767 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4768 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4769 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4770 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4771 <tag-name id="fs_readfilesync"><literal>readFileSync(<value>filename</value>[, |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4772 <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4773 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4774 Synchronously returns the contents of the file |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4775 with provided <literal>filename</literal>. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4776 The <literal>options</literal> parameter holds |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4777 <literal>string</literal> that specifies encoding. |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4778 If an encoding is specified, a string is returned, |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4779 otherwise, a Buffer object |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4780 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>) is returned. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4781 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4782 Before version <link doc="changes.xml" id="njs0.4.4">0.4.4</link>, |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4783 a <link id="string_tobytes">byte string</link> was returned |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4784 if encoding was not specified. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4785 </note> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4786 Otherwise, <literal>options</literal> is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4787 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4788 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4789 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4790 <tag-name><literal>encoding</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4791 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4792 encoding, by default is not specified. |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4793 The encoding can be <literal>utf8</literal>, |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4794 <literal>hex</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4795 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>), |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4796 <literal>base64</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4797 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>), |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4798 <literal>base64url</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4799 (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>). |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4800 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4801 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4802 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4803 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4804 file system <link id="njs_api_fs_flags">flag</link>, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4805 by default is <literal>r</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4806 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4807 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4808 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4809 <example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4810 >> var fs = require('fs') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4811 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4812 >> var file = fs.readFileSync('/file/path.tar.gz') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4813 undefined |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4814 >> var gzipped = file.slice(0,2).toString('hex') === '1f8b'; gzipped |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4815 true |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4816 </example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4817 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4818 |
2507 | 4819 <tag-name id="fs_realpathsync"><literal>realpathSync(<value>path</value>[, |
4820 <value>options</value>])</literal></tag-name> | |
4821 <tag-desc> | |
4822 Synchronously computes the canonical pathname by resolving | |
4823 <literal>.</literal>, <literal>..</literal> and symbolic links using | |
2508
d3d5b67a1462
Language fixes in njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2507
diff
changeset
|
4824 <link url="http://man7.org/linux/man-pages/man3/realpath.3.html">realpath(3)</link>. |
2507 | 4825 The <literal>options</literal> argument can be a string specifying an encoding, |
4826 or an object with an encoding property specifying the character encoding | |
4827 to use for the path passed to the callback | |
4828 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
4829 </tag-desc> | |
4830 | |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4831 <tag-name id="fs_renamesync"><literal>renameSync(<value>oldPath</value>, |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4832 <value>newPath</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4833 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4834 Synchronously changes the name or location of a file from |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4835 <literal>oldPath</literal> to <literal>newPath</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4836 (<link doc="changes.xml" id="njs0.3.4">0.3.4</link>). |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4837 <example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4838 >> var fs = require('fs') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4839 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4840 >> var file = fs.renameSync('hello.txt', 'HelloWorld.txt') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4841 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4842 </example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4843 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4844 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4845 <tag-name id="fs_rmdirsync"><literal>rmdirSync(<value>path</value>)</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4846 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4847 Synchronously removes a directory at the specified <literal>path</literal> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4848 (<link doc="changes.xml" id="njs0.4.2">0.4.2</link>). |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4849 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4850 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4851 <tag-name id="fs_statsync"><literal>statSync(<value>path</value>,[ |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4852 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4853 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4854 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4855 the <link id="fs_stats"><literal>fs.Stats</literal></link> object |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4856 for the specified <literal>path</literal> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4857 (<link doc="changes.xml" id="njs0.7.1">0.7.1</link>). |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4858 The <literal>path</literal> can be a |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4859 <literal>string</literal> or |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4860 <literal>buffer</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4861 The <literal>options</literal> parameter is expected to be |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4862 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4863 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4864 <tag-name><literal>throwIfNoEntry</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4865 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4866 a boolean value which indicates whether |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4867 an exception is thrown if no file system entry exists |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4868 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4869 by default is <literal>true</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4870 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4871 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4872 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4873 |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4874 <tag-name id="fs_symlinksync"><literal>symlinkSync(<value>target</value>, |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4875 <value>path</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4876 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4877 Synchronously creates the link called <literal>path</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4878 pointing to <literal>target</literal> using |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4879 <link url="http://man7.org/linux/man-pages/man2/symlink.2.html">symlink(2)</link> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4880 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4881 Relative targets are relative to the link’s parent directory. |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4882 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4883 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4884 <tag-name id="fs_writesync_buf"><literal>writeSync(<value>fd</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4885 <value>buffer</value>, <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4886 <value>length</value>[, <value>position</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4887 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4888 Writes a buffer to a file using file descriptor, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4889 returns the <literal>number</literal> of bytes written |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4890 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4891 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4892 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4893 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4894 <tag-name><literal>fd</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4895 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4896 an <literal>integer</literal> representing the file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4897 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4898 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4899 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4900 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4901 the <literal>buffer</literal> value can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4902 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4903 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4904 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4905 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4906 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4907 <tag-name><literal>offset</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4908 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4909 is an <literal>integer</literal> that determines |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4910 the part of the buffer to be written, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4911 by default <literal>0</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4912 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4913 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4914 <tag-name><literal>length</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4915 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4916 is an <literal>integer</literal> specifying the number of bytes to write, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4917 by default is an offset of |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4918 <link id="buffer_bytelength">Buffer.byteLength</link> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4919 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4920 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4921 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4922 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4923 refers to the offset from the beginning of the file |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4924 where this data should be written, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4925 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4926 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4927 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4928 by default is <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4929 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4930 <link url="https://man7.org/linux/man-pages/man2/write.2.html">pwrite(2)</link>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4931 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4932 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4933 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4934 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4935 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4936 <tag-name id="fs_writesync_str"><literal>writeSync(<value>fd</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4937 <value>string</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4938 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4939 <value>encoding</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4940 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4941 Writes a <literal>string</literal> to a file |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4942 using file descriptor <literal>fd</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4943 returns the <literal>number</literal> of bytes written |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4944 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4945 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4946 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4947 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4948 <tag-name><literal>fd</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4949 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4950 is an <literal>integer</literal> representing a file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4951 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4952 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4953 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4954 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4955 refers to the offset from the beginning of the file |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4956 where this data should be written, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4957 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4958 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4959 <literal>null</literal>, by default is <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4960 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4961 <link url="https://man7.org/linux/man-pages/man2/write.2.html">pwrite(2)</link> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4962 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4963 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4964 <tag-name><literal>encoding</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4965 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4966 is a <literal>string</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4967 by default is <literal>utf8</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4968 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4969 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4970 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4971 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4972 |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4973 <tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4974 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4975 Synchronously unlinks a file by <literal>path</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4976 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4977 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4978 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4979 <tag-name id="fs_writefilesync"><literal>writeFileSync(<value>filename</value>, |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4980 <value>data</value>[, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4981 <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4982 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4983 Synchronously writes <literal>data</literal> to a file |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4984 with provided <literal>filename</literal>. |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4985 The <literal>data</literal> is expected to be a string |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4986 or a Buffer object (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>). |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4987 If the file does not exist, it will be created, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4988 if the file exists, it will be replaced. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4989 The <literal>options</literal> parameter is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4990 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4991 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4992 <tag-name><literal>mode</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4993 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4994 mode option, by default is <literal>0o666</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4995 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4996 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4997 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4998 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4999 file system <link id="njs_api_fs_flags">flag</link>, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5000 by default is <literal>w</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5001 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5002 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5003 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5004 <example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5005 >> var fs = require('fs') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5006 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5007 >> var file = fs.writeFileSync('hello.txt', 'Hello world') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5008 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5009 </example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5010 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5011 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5012 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5013 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5014 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5015 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5016 <section id="fs_dirent" name="fs.Dirent"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5017 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5018 <para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5019 <literal>fs.Dirent</literal> is a representation of a directory entry— |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5020 a file or a subdirectory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5021 When |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5022 <link id="fs_readdirsync"><literal>readdirSync()</literal></link> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5023 is called with the |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5024 <link id="fs_readdirsync_withfiletypes"><literal>withFileTypes</literal></link> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5025 option, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5026 the resulting array contains <literal>fs.Dirent</literal> objects. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5027 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5028 <list type= "bullet" compact="no"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5029 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5030 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5031 <literal>dirent.isBlockDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5032 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5033 a block device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5034 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5035 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5036 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5037 <literal>dirent.isCharacterDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5038 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5039 a character device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5040 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5041 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5042 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5043 <literal>dirent.isDirectory()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5044 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5045 a file system directory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5046 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5047 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5048 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5049 <literal>dirent.isFIFO()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5050 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5051 a first-in-first-out (FIFO) pipe. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5052 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5053 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5054 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5055 <literal>dirent.isFile()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5056 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5057 a regular file. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5058 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5059 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5060 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5061 <literal>dirent.isSocket()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5062 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5063 a socket. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5064 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5065 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5066 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5067 <literal>dirent.isSymbolicLink()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5068 <literal>true</literal> if the <literal>fs.Dirent</literal> object describes |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5069 a symbolic link. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5070 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5071 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5072 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5073 <literal>dirent.name</literal>— |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5074 the name of the file <literal>fs.Dirent</literal> object refers to. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5075 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5076 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5077 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5078 </para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5079 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5080 </section> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5081 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5082 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5083 <section id="fs_filehandle" name="fs.FileHandle"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5084 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5085 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5086 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5087 <tr><td><link id="filehandle_close"><literal>filehandle.close()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5088 <tr><td><link id="filehandle_fd"><literal>filehandle.fd</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5089 <tr><td><link id="filehandle_read"><literal>filehandle.read()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5090 <tr><td><link id="filehandle_stat"><literal>filehandle.stat()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5091 <tr><td><link id="filehandle_write_buf"><literal>filehandle.write(<value>buf</value>)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5092 <tr><td><link id="filehandle_write_str"><literal>filehandle.write(<value>str</value>)</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5093 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5094 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5095 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5096 <para> |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5097 The <literal>FileHandle</literal> object is an object wrapper |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5098 for a numeric file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5099 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5100 Instances of the <literal>FileHandle</literal> object are created by the |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5101 <link id="fs_promises_open"><literal>fs.promises.open()</literal></link> method. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5102 If a <literal>FileHandle</literal> is not closed using the |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5103 <link id="filehandle_close"><literal>filehandle.close()</literal></link> method, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5104 it will try to automatically close the file descriptor, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5105 helping to prevent memory leaks. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5106 Please do not rely on this behavior because it can be unreliable. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5107 Instead, always explicitly close a <literal>FileHandle</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5108 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5109 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5110 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5111 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5112 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5113 <tag-name id="filehandle_close"><literal>filehandle.close()</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5114 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5115 Closes the file handle after waiting for any pending operation on the handle |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5116 to complete. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5117 Returns a <literal>promise</literal>, fulfills with undefined upon success. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5118 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5119 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5120 <tag-name id="filehandle_fd"><literal>filehandle.fd</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5121 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5122 The numeric file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5123 managed by the <literal>FileHandle</literal> object. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5124 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5125 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5126 <tag-name id="filehandle_read"><literal>filehandle.read(<value>buffer</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5127 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5128 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5129 <value>position</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5130 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5131 Reads data from the file and stores that in the given buffer. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5132 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5133 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5134 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5135 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5136 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5137 a buffer that will be filled with the file data read, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5138 the value can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5139 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5140 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5141 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5142 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5143 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5144 <tag-name><literal>offset</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5145 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5146 is an <literal>integer</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5147 representing the location in the buffer at which to start filling |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5148 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5149 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5150 <tag-name><literal>length</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5151 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5152 is an <literal>integer</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5153 representing the number of bytes to read |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5154 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5155 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5156 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5157 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5158 the location where to begin reading data from the file, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5159 the value can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5160 <literal>integer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5161 <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5162 If <literal>null</literal>, data will be read from the current file position |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5163 and the position will be updated. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5164 If position is an <literal>integer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5165 the current file position will remain unchanged. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5166 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5167 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5168 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5169 Returns a <literal>Promise</literal> which fulfills upon success |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5170 with an object with two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5171 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5172 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5173 <tag-name><literal>bytesRead</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5174 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5175 is an <literal>integer</literal> representing the number of bytes read |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5176 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5177 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5178 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5179 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5180 is a reference to the passed argument in buffer, can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5181 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5182 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5183 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5184 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5185 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5186 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5187 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5188 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5189 <tag-name id="filehandle_stat"><literal>filehandle.stat()</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5190 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5191 Fulfills with an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5192 <link id="fs_stats">fs.Stats</link> for the file, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5193 returns a <literal>promise</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5194 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5195 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5196 <tag-name id="filehandle_write_buf"><literal>filehandle.write(<value>buffer</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5197 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5198 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5199 <value>position</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5200 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5201 Writes a buffer to the file. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5202 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5203 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5204 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5205 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5206 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5207 the <literal>buffer</literal> value can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5208 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5209 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5210 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5211 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5212 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5213 <tag-name><literal>offset</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5214 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5215 is an <literal>integer</literal> representing |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5216 the start position from within buffer where the data to write begins |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5217 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5218 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5219 <tag-name><literal>length</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5220 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5221 is an <literal>integer</literal> representing |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5222 the number of bytes from buffer to write, by default |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5223 is an offset of |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5224 <link id="buffer_bytelength">Buffer.byteLength</link> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5225 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5226 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5227 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5228 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5229 the offset from the beginning of the file |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5230 where the data from buffer should be written, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5231 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5232 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5233 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5234 by default is <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5235 If <literal>position</literal> is not a <literal>number</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5236 the data will be written at the current position. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5237 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5238 <link url="https://man7.org/linux/man-pages/man2/write.2.html">pwrite(2)</link> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5239 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5240 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5241 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5242 Returns a <literal>Promise</literal> which is resolved with an object |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5243 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5244 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5245 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5246 <tag-name><literal>bytesWritten</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5247 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5248 is an <literal>integer</literal> representing the number of bytes written |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5249 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5250 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5251 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5252 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5253 a reference to the buffer written, can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5254 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5255 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5256 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5257 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5258 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5259 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5260 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5261 It is unsafe to use <literal>filehandle.write()</literal> multiple times |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5262 on the same file without waiting for the promise to be resolved or rejected. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5263 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5264 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5265 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5266 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5267 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5268 <tag-name id="filehandle_write_str"><literal>filehandle.write(<value>string</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5269 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5270 <value>encoding</value>]])</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5271 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5272 Writes a <literal>string</literal> to the file. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5273 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5274 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5275 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5276 <tag-name><literal>position</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5277 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5278 the offset from the beginning of the file |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5279 where the data from buffer should be written, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5280 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5281 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5282 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5283 by default is <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5284 If <literal>position</literal> is not a <literal>number</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5285 the data will be written at the current position. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5286 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5287 <link url="https://man7.org/linux/man-pages/man2/write.2.html">pwrite(2)</link> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5288 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5289 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5290 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5291 <tag-name><literal>encoding</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5292 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5293 the expected encoding of the string, by default <literal>utf8</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5294 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5295 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5296 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5297 Returns a <literal>Promise</literal> which is resolved with an object |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5298 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5299 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5300 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5301 <tag-name><literal>bytesWritten</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5302 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5303 is an <literal>integer</literal> representing the number of bytes written |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5304 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5305 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5306 <tag-name><literal>buffer</literal></tag-name> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5307 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5308 a reference to the buffer written, can be a |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5309 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5310 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5311 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5312 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5313 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5314 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5315 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5316 It is unsafe to use <literal>filehandle.write()</literal> multiple times |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5317 on the same file without waiting for the promise to be resolved or rejected. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5318 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5319 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5320 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5321 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5322 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5323 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5324 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5325 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5326 </section> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5327 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5328 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5329 <section id="fs_stats" name="fs.Stats"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5330 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5331 <para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5332 The <literal>fs.Stats</literal> object provides information about a file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5333 The object is returned from |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5334 <link id="fs_statsync">fs.statSync()</link> and |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5335 <link id="fs_lstatsync">fs.lstatSync()</link>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5336 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5337 <list type= "bullet" compact="no"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5338 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5339 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5340 <literal>stats.isBlockDevice()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5341 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5342 a block device. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5343 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5344 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5345 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5346 <literal>stats.isDirectory()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5347 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5348 a file system directory. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5349 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5350 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5351 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5352 <literal>stats.isFIFO()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5353 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5354 a first-in-first-out (FIFO) pipe. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5355 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5356 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5357 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5358 <literal>stats.isFile()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5359 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5360 a regular file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5361 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5362 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5363 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5364 <literal>stats.isSocket()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5365 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5366 a socket. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5367 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5368 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5369 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5370 <literal>stats.isSymbolicLink()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5371 <literal>true</literal> if the <literal>fs.Stats</literal> object describes |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5372 a symbolic link. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5373 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5374 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5375 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5376 <literal>stats.dev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5377 the numeric identifier of the device containing the file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5378 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5379 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5380 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5381 <literal>stats.ino</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5382 the file system specific <literal>Inode</literal> number for the file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5383 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5384 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5385 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5386 <literal>stats.mode</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5387 a bit-field describing the file type and mode. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5388 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5389 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5390 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5391 <literal>stats.nlink</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5392 the number of hard-links that exist for the file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5393 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5394 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5395 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5396 <literal>stats.uid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5397 the numeric user identifier of the user that owns the file (POSIX). |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5398 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5399 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5400 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5401 <literal>stats.gid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5402 the numeric group identifier of the group that owns the file (POSIX). |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5403 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5404 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5405 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5406 <literal>stats.rdev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5407 the numeric device identifier if the file represents a device. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5408 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5409 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5410 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5411 <literal>stats.size</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5412 the size of the file in bytes. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5413 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5414 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5415 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5416 <literal>stats.blksize</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5417 the file system block size for i/o operations. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5418 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5419 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5420 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5421 <literal>stats.blocks</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5422 the number of blocks allocated for this file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5423 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5424 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5425 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5426 <literal>stats.atimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5427 the timestamp indicating the last time this file was accessed expressed |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5428 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5429 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5430 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5431 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5432 <literal>stats.mtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5433 the timestamp indicating the last time this file was modified expressed |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5434 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5435 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5436 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5437 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5438 <literal>stats.ctimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5439 the timestamp indicating the last time this file was changed expressed |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5440 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5441 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5442 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5443 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5444 <literal>stats.birthtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5445 the timestamp indicating the creation time of this file expressed |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5446 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5447 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5448 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5449 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5450 <literal>stats.atime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5451 the timestamp indicating the last time this file was accessed. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5452 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5453 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5454 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5455 <literal>stats.mtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5456 the timestamp indicating the last time this file was modified. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5457 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5458 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5459 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5460 <literal>stats.ctime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5461 the timestamp indicating the last time this file was changed. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5462 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5463 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5464 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5465 <literal>stats.birthtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5466 the timestamp indicating the creation time of this file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5467 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5468 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5469 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5470 </para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5471 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5472 </section> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5473 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5474 |
2507 | 5475 <section id="access_const" name="File Access Constants"> |
5476 | |
5477 <para> | |
5478 The <link id="fs_accesssync"><literal>access()</literal></link> method | |
5479 can accept the following flags. | |
5480 These flags are exported by <literal>fs.constants</literal>: | |
5481 | |
5482 <list type= "bullet" compact="no"> | |
5483 | |
5484 <listitem> | |
5485 <literal>F_OK</literal>—indicates that the file | |
5486 is visible to the calling process, | |
5487 used by default if no mode is specified | |
5488 </listitem> | |
5489 | |
5490 <listitem> | |
5491 <literal>R_OK</literal>—indicates that the file can be | |
5492 read by the calling process | |
5493 </listitem> | |
5494 | |
5495 <listitem> | |
5496 <literal>W_OK</literal>—indicates that the file can be | |
5497 written by the calling process | |
5498 </listitem> | |
5499 | |
5500 <listitem> | |
5501 <literal>X_OK</literal>—indicates that the file can be | |
5502 executed by the calling process | |
5503 </listitem> | |
5504 | |
5505 </list> | |
5506 </para> | |
5507 | |
5508 </section> | |
5509 | |
5510 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5511 <section id="njs_api_fs_flags" name="File System Flags"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5512 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5513 <para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5514 The <literal>flag</literal> option can accept the following values: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5515 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5516 <list type= "bullet" compact="no"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5517 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5518 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5519 <literal>a</literal>—open a file for appending. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5520 The file is created if it does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5521 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5522 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5523 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5524 <literal>ax</literal>—the same as <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5525 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5526 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5527 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5528 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5529 <literal>a+</literal>—open a file for reading and appending. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5530 If the file does not exist, it will be created |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5531 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5532 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5533 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
5534 <literal>ax+</literal>—the same as <literal>a+</literal> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5535 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5536 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5537 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5538 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
5539 <literal>as</literal>—open a file for appending |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
5540 in synchronous mode. |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5541 If the file does not exist, it will be created |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5542 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5543 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5544 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5545 <literal>as+</literal>—open a file for reading and appending |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5546 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5547 If the file does not exist, it will be created |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5548 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5549 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5550 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5551 <literal>r</literal>—open a file for reading. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5552 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5553 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5554 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5555 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5556 <literal>r+</literal>—open a file for reading and writing. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5557 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5558 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5559 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5560 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5561 <literal>rs+</literal>—open a file for reading and writing |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5562 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5563 Instructs the operating system to bypass the local file system cache |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5564 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5565 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5566 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5567 <literal>w</literal>—open a file for writing. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5568 If the file does not exist, it will be created. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5569 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5570 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5571 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5572 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5573 <literal>wx</literal>—the same as <literal>w</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5574 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5575 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5576 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5577 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5578 <literal>w+</literal>—open a file for reading and writing. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5579 If the file does not exist, it will be created. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5580 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5581 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5582 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5583 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5584 <literal>wx+</literal>—the same as <literal>w+</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5585 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5586 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5587 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5588 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5589 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5590 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5591 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5592 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5593 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5594 |
2583
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5595 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5596 <section id="querystring" name="Query String"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5597 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5598 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5599 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5600 <tr><td><link id="querystring_decode"><literal>querystring.decode()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5601 <tr><td><link id="querystring_encode"><literal>querystring.encode()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5602 <tr><td><link id="querystring_escape"><literal>querystring.escape()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5603 <tr><td><link id="querystring_parse"><literal>querystring.parse()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5604 <tr><td><link id="querystring_stringify"><literal>querystring.stringify()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5605 <tr><td><link id="querystring_unescape"><literal>querystring.unescape()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5606 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5607 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5608 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5609 <para> |
2583
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5610 The Query String module provides support |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5611 for parsing and formatting URL query strings |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5612 (<link doc="changes.xml" id="njs0.4.3">0.4.3</link>). |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5613 The Query String module object is returned by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5614 <literal>require('querystring')</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5615 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5616 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5617 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5618 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5619 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5620 <tag-name id="querystring_decode"><literal>querystring.decode()</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5621 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5622 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5623 <link id="querystring_parse"><literal>querystring.parse()</literal></link>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5624 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5625 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5626 <tag-name id="querystring_encode"><literal>querystring.encode()</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5627 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5628 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5629 <link id="querystring_stringify"><literal>querystring.stringify()</literal></link>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5630 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5631 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5632 <tag-name id="querystring_escape"><literal>querystring.escape(<value>string</value>)</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5633 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5634 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5635 Performs URL encoding of the given <literal>string</literal>, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5636 returns an escaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5637 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5638 <link id="querystring_stringify"><literal>querystring.stringify()</literal></link> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5639 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5640 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5641 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5642 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5643 <tag-name id="querystring_parse"><literal>querystring.parse(<value>string</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5644 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5645 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5646 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5647 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5648 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5649 Parses the query string URL and returns an object. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5650 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5651 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5652 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5653 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5654 for delimiting key and value pairs in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5655 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5656 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5657 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5658 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5659 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5660 for delimiting keys and values in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5661 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5662 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5663 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5664 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5665 The <literal>options</literal> parameter is expected to be |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5666 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5667 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5668 <tag-name><literal>decodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5669 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5670 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5671 Function used |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5672 to decode percent-encoded characters in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5673 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5674 <link id="querystring_unescape"><literal>querystring.unescape()</literal></link> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5675 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5676 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5677 <tag-name><literal>maxKeys</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5678 <value>number</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5679 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5680 the maximum number of keys to parse, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5681 by default is <literal>1000</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5682 The <literal>0</literal> value removes limitations for counting keys. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5683 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5684 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5685 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5686 By default, percent-encoded characters within the query string are assumed |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5687 to use the UTF-8 encoding, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5688 invalid UTF-8 sequences will be replaced with |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5689 the <literal>U+FFFD</literal> replacement character. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5690 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5691 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5692 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5693 For example, for the following query string |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5694 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5695 'foo=bar&abc=xyz&abc=123' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5696 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5697 the output will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5698 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5699 { |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5700 foo: 'bar', |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5701 abc: ['xyz', '123'] |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5702 } |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5703 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5704 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5705 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5706 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5707 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5708 <tag-name id="querystring_stringify"><literal>querystring.stringify(<value>object</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5709 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5710 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5711 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5712 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5713 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5714 Serializes an object and returns a URL query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5715 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5716 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5717 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5718 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5719 for delimiting key and value pairs in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5720 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5721 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5722 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5723 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5724 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5725 for delimiting keys and values in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5726 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5727 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5728 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5729 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5730 The <literal>options</literal> parameter is expected to be |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5731 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5732 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5733 <tag-name><literal>encodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5734 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5735 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5736 The function to use when converting |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5737 URL-unsafe characters to percent-encoding in the query string, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5738 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5739 <link id="querystring_escape"><literal>querystring.escape()</literal></link>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5740 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5741 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5742 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5743 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5744 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5745 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5746 By default, characters that require percent-encoding within the query string |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5747 are encoded as UTF-8. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5748 If other encoding is required, then |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5749 <literal>encodeURIComponent</literal> option should be specified. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5750 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5751 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5752 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5753 For example, for the following command |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5754 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5755 querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], 123: '' }); |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5756 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5757 the query string will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5758 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5759 'foo=bar&baz=qux&baz=quux&123=' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5760 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5761 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5762 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5763 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5764 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5765 <tag-name id="querystring_unescape"><literal>querystring.unescape(<value>string</value>)</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5766 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5767 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5768 Performs decoding of URL percent-encoded characters |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5769 of the <literal>string</literal>, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5770 returns an unescaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5771 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5772 <link id="querystring_parse"><literal>querystring.parse()</literal></link> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5773 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5774 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5775 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5776 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5777 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5778 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5779 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5780 </section> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5781 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5782 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5783 <section id="xml" name="XML"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5784 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5785 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5786 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5787 <tr><td><link id="xml_parse"><literal>xml.parse()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5788 <tr><td><link id="xml_c14n"><literal>xml.c14n()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5789 <tr><td><link id="xml_exclusivec14n"><literal>xml.exclusiveC14n()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5790 <tr><td><link id="xml_serialize"><literal>xml.serialize()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5791 <tr><td><link id="xml_serialize_tostring"><literal>xml.serializeToString()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5792 <tr><td><link id="xml_doc"><literal>XMLDoc</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5793 <tr><td><link id="xml_node"><literal>XMLNode</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5794 <tr><td><link id="xml_xmlattr"><literal>XMLAttr</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5795 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5796 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5797 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5798 <para> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5799 The XML module allows working with XML documents |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5800 (since <link doc="changes.xml" id="njs0.7.10">0.7.10</link>). |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5801 The XML module object is returned by |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5802 <literal>require('xml')</literal>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5803 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5804 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5805 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5806 Example: |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5807 <example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5808 const xml = require("xml"); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5809 let data = `<note><to b="bar" a= "foo" >Tove</to><from>Jani</from></note>`; |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5810 let doc = xml.parse(data); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5811 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5812 console.log(doc.note.to.$text) /* 'Tove' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5813 console.log(doc.note.to.$attr$b) /* 'bar' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5814 console.log(doc.note.$tags[1].$text) /* 'Jani' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5815 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5816 let dec = new TextDecoder(); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5817 let c14n = dec.decode(xml.exclusiveC14n(doc.note)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5818 console.log(c14n) /* '<note><to a="foo" b="bar">Tove</to><from>Jani</from></note>' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5819 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5820 c14n = dec.decode(xml.exclusiveC14n(doc.note.to)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5821 console.log(c14n) /* '<to a="foo" b="bar">Tove</to>' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5822 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5823 c14n = dec.decode(xml.exclusiveC14n(doc.note, doc.note.to /* excluding 'to' */)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5824 console.log(c14n) /* '<note><from>Jani</from></note>' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5825 </example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5826 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5827 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5828 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5829 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5830 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5831 <tag-name id="xml_parse"><literal>parse(<value>string</value> | |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5832 <value>Buffer</value>)</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5833 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5834 Parses a string or Buffer for an XML document, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5835 returns an |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5836 <link id="xml_doc"><literal>XMLDoc</literal></link> wrapper object |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5837 representing the parsed XML document. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5838 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5839 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5840 <tag-name id="xml_c14n"><literal>c14n(<value>root_node</value>[, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5841 <value>excluding_node</value>])</literal></tag-name> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5842 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5843 Canonicalizes <literal>root_node</literal> and its children according to |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5844 <link url="https://www.w3.org/TR/xml-c14n">Canonical XML Version 1.1</link>. |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5845 The <literal>root_node</literal> can be |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5846 <link id="xml_node"><literal>XMLNode</literal></link> or |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5847 <link id="xml_doc"><literal>XMLDoc</literal></link> wrapper object |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5848 around XML structure. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5849 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5850 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5851 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5852 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5853 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5854 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5855 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5856 allows omitting from the output a part of the document |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5857 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5858 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5859 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5860 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5861 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5862 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5863 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5864 <tag-name id="xml_exclusivec14n"><literal>exclusiveC14n(<value>root_node</value>[, |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5865 <value>excluding_node</value>[, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5866 <value>withComments</value> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5867 [,<value>prefix_list</value>]]])</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5868 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5869 Canonicalizes <literal>root_node</literal> and its children according to |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5870 <link url="https://www.w3.org/TR/xml-exc-c14n/">Exclusive XML |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5871 Canonicalization Version 1.0</link>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5872 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5873 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5874 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5875 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5876 <tag-name><literal>root_node</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5877 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5878 is |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5879 <link id="xml_node"><literal>XMLNode</literal></link> or |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5880 <link id="xml_doc"><literal>XMLDoc</literal></link> wrapper object |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5881 around XML structure |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5882 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5883 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5884 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5885 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5886 allows omitting from the output a part of the document |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5887 corresponding to the node and its children |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5888 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5889 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5890 <tag-name><literal>withComments</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5891 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5892 a boolean value, <literal>false</literal> by default. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5893 If <literal>true</literal>, canonicalization corresponds to |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5894 <link url="http://www.w3.org/2001/10/xml-exc-c14n#WithComments">Exclusive XML |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5895 Canonicalization Version 1.0</link>. |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5896 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5897 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5898 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5899 <tag-name><literal>prefix_list</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5900 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5901 an optional string with a space separated namespace prefixes |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5902 for namespaces that should also be included into the output |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5903 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5904 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5905 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5906 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5907 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5908 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5909 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5910 <tag-name id="xml_serialize"><literal>serialize()</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5911 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5912 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5913 <link id="xml_c14n"><literal>xml.c14n()</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5914 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5915 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5916 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5917 <tag-name id="xml_serialize_tostring"><literal>serializeToString()</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5918 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5919 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5920 <link id="xml_c14n"><literal>xml.c14n()</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5921 except it returns the result as a <literal>string</literal> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5922 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5923 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5924 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5925 <tag-name id="xml_doc"><literal>XMLDoc</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5926 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5927 An XMLDoc wrapper object around XML structure, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5928 the root node of the document. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5929 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5930 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5931 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5932 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5933 <tag-name id="xml_doc_root"><literal>doc.$root</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5934 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5935 the document's root by its name or undefined |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5936 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5937 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5938 <tag-name id="xml_doc_xxx"><literal>doc.<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5939 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5940 the first root tag named <value>abc</value> as |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5941 <link id="xml_node"><literal>XMLNode</literal></link> wrapper object |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5942 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5943 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5944 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5945 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5946 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5947 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5948 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5949 <tag-name id="xml_node"><literal>XMLNode</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5950 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5951 An XMLNode wrapper object around XML tag node. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5952 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5953 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5954 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5955 <tag-name id="node_abc"><literal>node.<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5956 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5957 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5958 <link id="node_tag"><literal>node.$tag$<value>abc</value></literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5959 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5960 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5961 <tag-name id="node_attr"><literal>node.$attr$<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5962 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5963 the node's attribute value of <value>abc</value>, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5964 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5965 since <link doc="changes.xml" id="njs0.7.11">0.7.11</link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5966 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5967 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5968 <tag-name id="node_attr_value"><literal>node.$attr$<value>abc</value></literal>=<value>xyz</value></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5969 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5970 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5971 <link id="node_setattribute"><literal>node.setAttribute('<value>abc</value>', |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5972 <value>xyz</value>)</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5973 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>) |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5974 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5975 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5976 <tag-name id="node_attrs"><literal>node.$attrs</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5977 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5978 an <link id="xml_xmlattr"><literal>XMLAttr</literal></link> wrapper object |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5979 for all attributes of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5980 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5981 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5982 <tag-name id="node_name"><literal>node.$name</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5983 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5984 the name of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5985 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5986 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5987 <tag-name id="node_ns"><literal>node.$ns</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5988 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5989 the namespace of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5990 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5991 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5992 <tag-name id="node_parent"><literal>node.$parent</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5993 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5994 the parent node of the current node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5995 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5996 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5997 <tag-name id="node_tag"><literal>node.$tag$<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5998 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5999 the first child tag of the node named <value>abc</value>, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6000 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6001 since <link doc="changes.xml" id="njs0.7.11">0.7.11</link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6002 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6003 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6004 <tag-name id="node_tags"><literal>node.$tags</literal></tag-name> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6005 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6006 an array of all children tags |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6007 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6008 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6009 <tag-name id="node_tags_"><literal>node.$tags = [node1, node2, ...]</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6010 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6011 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6012 <link id="node_removechildren"><literal>node.removeChildren</literal>()</link>; |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6013 <link id="node_addchild"><literal>node.addChild(<value>node1</value>)</literal></link>; |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6014 <link id="node_addchild"><literal>node.addChild(<value>node2</value>)</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6015 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6016 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6017 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6018 <tag-name id="node_tags_abc"><literal>node.$tags$<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6019 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6020 all children tags named <value>abc</value> of the node, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6021 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6022 since <link doc="changes.xml" id="njs0.7.11">0.7.11</link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6023 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6024 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6025 <tag-name id="node_text"><literal>node.$text</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6026 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6027 the content of the node, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6028 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6029 since <link doc="changes.xml" id="njs0.7.11">0.7.11</link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6030 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6031 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6032 <tag-name id="node_text_abc"><literal>node.$text = 'abc' </literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6033 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6034 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6035 <link id="node_settext"><literal>node.setText('abc')</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6036 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>) |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6037 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6038 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6039 <tag-name id="node_addchild"><literal>node.addChild(<value>nd</value>)</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6040 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6041 adds XMLNode as a child to node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6042 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6043 <literal>nd</literal> is recursively copied before adding to the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6044 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6045 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6046 <tag-name id="node_removeallattr"><literal>node.removeAllAttributes()</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6047 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6048 removes all attributes of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6049 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>) |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6050 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6051 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6052 <tag-name id="node_removeattr"><literal>node.removeAttribute(<value>attr_name</value>)</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6053 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6054 removes the attribute named <literal>attr_name</literal> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6055 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>) |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6056 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6057 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6058 <tag-name id="node_removechildren"><literal>node.removeChildren(<value>tag_name</value>)</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6059 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6060 removes all the children tags named <literal>tag_name</literal> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6061 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6062 If <literal>tag_name</literal> is absent, all children tags are removed |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6063 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6064 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6065 <tag-name id="node_removetext"><literal>node.removeText()</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6066 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6067 removes the node's text value |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6068 (<link doc="changes.xml" id="njs0.7.11">0.7.11</link>) |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6069 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6070 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6071 <tag-name id="node_setattr"><literal>node.setAttribute(<value>attr_name</value>, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6072 <value>value</value>)</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6073 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6074 sets a value for an <literal>attr_name</literal> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6075 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6076 When the value is <literal>null</literal>, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6077 the attribute named <literal>attr_name</literal> is deleted |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6078 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6079 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6080 <tag-name id="node_settext"><literal>node.setText(<value>value</value>)</literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6081 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6082 sets a text value for the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6083 (since <link doc="changes.xml" id="njs0.7.11">0.7.11</link>). |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6084 When the value is <literal>null</literal>, the text of the node is deleted. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6085 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6086 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6087 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6088 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6089 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6090 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6091 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6092 <tag-name id="xml_xmlattr"><literal>XMLAttr</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6093 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6094 An XMLAttrs wrapper object around XML node attributes. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6095 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6096 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6097 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6098 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6099 <tag-name id="xmlattr_x"><literal>attr.<value>abc</value></literal></tag-name> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6100 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6101 the attribute value of <value>abc</value> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6102 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6103 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6104 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6105 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6106 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6107 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6108 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6109 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6110 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6111 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6112 </section> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6113 |
2951
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6114 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6115 <section id="zlib" name="zlib"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6116 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6117 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6118 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6119 <tr><td><link id="zlib_deflaterawsync"><literal>zlib.deflateRawSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6120 <tr><td><link id="zlib_deflatesync"><literal>zlib.deflateSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6121 <tr><td><link id="zlib_inflaterawsync"><literal>zlib.inflateRawSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6122 <tr><td><link id="zlib_inflatesync"><literal>zlib.inflateSync()</literal></link></td></tr> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6123 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6124 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6125 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6126 <para> |
2951
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6127 The zlib module provides compression functionality using the |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6128 “deflate” and “inflate” algorithms |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6129 (since <link doc="changes.xml" id="njs0.7.12">0.7.12</link>). |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6130 The zlib module object is returned by |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6131 <literal>require('zlib')</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6132 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6133 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6134 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6135 <list type="tag"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6136 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6137 <tag-name id="zlib_deflaterawsync"><literal>deflateRawSync(<value>string</value> | |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6138 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6139 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6140 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6141 Compresses data using the “deflate” algorithm provided as a string or Buffer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6142 and does not append a zlib header. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6143 The buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6144 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6145 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6146 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6147 <literal>Options</literal> is an optional object that contains |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6148 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6149 Returns Buffer instance that contains the compressed data. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6150 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6151 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6152 <tag-name id="zlib_deflatesync"><literal>deflateSync(<value>string</value> | |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6153 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6154 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6155 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6156 Compresses data using the “deflate” algorithm provided as a string or Buffer. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6157 The Buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6158 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6159 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6160 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6161 <literal>Options</literal> is an optional object that contains |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6162 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6163 Returns Buffer instance that contains the compressed data. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6164 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6165 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6166 <tag-name id="zlib_inflaterawsync"><literal>inflateRawSync(<value>string</value> | |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6167 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6168 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6169 Decompresses a raw stream by using the “deflate” algorithm. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6170 Returns Buffer instance that contains the decompressed data. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6171 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6172 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6173 <tag-name id="zlib_inflatesync"><literal>inflateSync(<value>string</value> | |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6174 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6175 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6176 Decompresses a stream by using the “deflate” algorithm. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6177 Returns Buffer instance that contains the decompressed data. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6178 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6179 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6180 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6181 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6182 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6183 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6184 <section id="zlib_options" name="zlib options"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6185 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6186 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6187 <list type= "bullet" compact="no"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6188 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6189 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6190 <literal>chunkSize</literal>—is an integer, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6191 by default is <literal>1024</literal> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6192 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6193 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6194 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6195 <literal>dictionary</literal>—is a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6196 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6197 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6198 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6199 by default is empty |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6200 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6201 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6202 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6203 <literal>level</literal>—is an integer, compression only, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6204 see <link id="zlib_compression_levels"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6205 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6206 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6207 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6208 <literal>memLevel</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6209 from <literal>1</literal> to <literal>9</literal>, compression only |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6210 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6211 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6212 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6213 <literal>strategy</literal>—is an integer, compression only, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6214 see <link id="zlib_compression_strategy"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6215 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6216 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6217 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6218 <literal>windowBits</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6219 from <literal>-15</literal> to <literal>-9</literal> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6220 for raw data, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6221 from <literal>9</literal> to <literal>15</literal> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6222 for an ordinary stream |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6223 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6224 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6225 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6226 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6227 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6228 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6229 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6230 <section id="zlib_compression_levels" name="zlib compression levels"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6231 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6232 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6233 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6234 <tr><td>Name</td><td>Description</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6235 <tr><td><literal>zlib.constants.Z_NO_COMPRESSION</literal></td><td>no compression</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6236 <tr><td><literal>zlib.constants.Z_BEST_SPEED</literal></td><td>fastest, produces the least compression</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6237 <tr><td><literal>zlib.constants.Z_DEFAULT_COMPRESSION</literal></td><td>trade-off between speed and compression</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6238 <tr><td><literal>zlib.constants.Z_BEST_COMPRESSION</literal></td><td>slowest, produces the most compression</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6239 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6240 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6241 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6242 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6243 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6244 <section id="zlib_compression_strategy" name="zlib compression strategy"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6245 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6246 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6247 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6248 <tr><td>Name</td><td>Description</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6249 <tr><td><literal>zlib.constants.Z_FILTERED</literal></td><td>Filtered strategy: for the data produced by a filter or predictor</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6250 <tr><td><literal>zlib.constants.Z_HUFFMAN_ONLY</literal></td><td>Huffman-only strategy: only Huffman encoding, no string matching</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6251 <tr><td><literal>zlib.constants.Z_RLE</literal></td><td>Run Length Encoding strategy: limit match distances to one, better compression of PNG image data</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6252 <tr><td><literal>zlib.constants.Z_FIXED</literal></td><td>Fixed table strategy: prevents the use of dynamic Huffman codes, a simpler decoder for special applications</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6253 <tr><td><literal>zlib.constants.Z_DEFAULT_STRATEGY</literal></td><td>Default strategy, suitable for general purpose compression</td></tr> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6254 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6255 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6256 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6257 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6258 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6259 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6260 |
2176 | 6261 </section> |
6262 | |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6263 </article> |