Mercurial > hg > nginx-site
annotate xml/en/docs/njs/reference.xml @ 3028:55f8ce8a8cb0
Linux packages: actualized supported Alpine Linux versions.
author | Konstantin Pavlov <thresh@nginx.com> |
---|---|
date | Mon, 11 Dec 2023 17:42:59 -0800 |
parents | ec6f7fcd3d90 |
children | e6b785b7e308 |
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" |
3021
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
12 rev="120"> |
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> |
3001
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
205 outgoing headers object for the main request, writable. |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
206 |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
207 <para> |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
208 If <literal>r.headersOut{}</literal> is the response object of |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
209 a <link id="r_subrequest">subrequest</link>, it represents response headers. |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
210 In this case, field values in |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
211 <header>Accept-Ranges</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
212 <header>Connection</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
213 <header>Content-Disposition</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
214 <header>Content-Encoding</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
215 <header>Content-Length</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
216 <header>Content-Range</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
217 <header>Date</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
218 <header>Keep-Alive</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
219 <header>Server</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
220 <header>Transfer-Encoding</header>, |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
221 <header>X-Accel-*</header> |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
222 response headers may be omitted. |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
223 </para> |
7c3182a95cd6
Enhanced description of r.headersOut in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2998
diff
changeset
|
224 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
225 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
226 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
|
227 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
|
228 <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
|
229 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
230 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
231 <para> |
2894
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
232 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
|
233 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
|
234 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
|
235 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
236 <list type="bullet"> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
237 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
238 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
239 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
|
240 <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
|
241 <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
|
242 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
243 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
244 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
245 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
|
246 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
247 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
248 </list> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
249 </para> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
250 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
251 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
252 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
|
253 (<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
|
254 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
|
255 <example> |
2544
33347df1da9c
Relocated sentence in r.headers.Out, added dot, corrected quotes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2543
diff
changeset
|
256 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
|
257 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
258 where the output will be: |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
259 <example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
260 Foo: a |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
261 Foo: b |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
262 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
263 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
|
264 will be deleted. |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
265 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
266 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
267 <para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
268 For standard response headers |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
269 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
|
270 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
271 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
|
272 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
|
273 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
|
274 Duplicate field values in |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
275 <header>Age</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
276 <header>Content-Encoding</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
277 <header>Content-Length</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
278 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
279 <header>ETag</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
280 <header>Expires</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
281 <header>Last-Modified</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
282 <header>Location</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
283 <header>Retry-After</header> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
284 response headers are ignored. |
2537
d6bbfd20c82f
Rephrased a sentence in r.headersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2532
diff
changeset
|
285 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
|
286 are separated by commas. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
287 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
288 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
289 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
290 <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
|
291 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
292 HTTP version, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
293 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
294 |
2888
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
295 <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
|
296 <tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
297 boolean value, true for |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
298 <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
|
299 locations |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
300 </tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
301 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
302 <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
|
303 <tag-desc> |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
304 performs an |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
305 <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
|
306 redirect</link> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
307 to the specified <literal>uri</literal>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
308 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
|
309 it is considered a named location. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
310 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
|
311 <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
|
312 locations. |
2525
6ce28e0beec0
Updated description of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2509
diff
changeset
|
313 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
|
314 <para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
315 <note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
316 After redirect, |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
317 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
|
318 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
|
319 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
|
320 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
|
321 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
|
322 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
|
323 <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
|
324 <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
|
325 can be used. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
326 </note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
327 </para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
328 |
2848
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
329 <para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
330 <note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
331 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
|
332 the method accepts escaped URIs. |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
333 </note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
334 </para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
335 |
2247
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 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
338 <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
|
339 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
340 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
341 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
|
342 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
343 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
344 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
345 <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
|
346 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
347 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
|
348 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
349 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
350 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
351 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
352 <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
|
353 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
354 HTTP method, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
355 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
356 |
2497
805c4b84cc61
Added missing feature and links to njs-0.3.8 Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2496
diff
changeset
|
357 <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
|
358 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
359 references the parent request object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
360 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
361 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
362 <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
|
363 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
364 client address, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
365 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
366 |
2628 | 367 <tag-name id="r_request_body"><literal>r.requestBody</literal></tag-name> |
368 <tag-desc> | |
2981
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
369 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
|
370 <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
|
371 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
|
372 The <link id="r_request_buffer"><literal>r.requestBuffer</literal></link> or |
2628 | 373 <link id="r_request_text"><literal>r.requestText</literal></link> property |
374 should be used instead. | |
375 </tag-desc> | |
376 | |
377 <tag-name id="r_request_buffer"><literal>r.requestBuffer</literal></tag-name> | |
378 <tag-desc> | |
379 client request body if it has not been written to a temporary file | |
380 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
381 To ensure that the client request body is in memory, | |
382 its size should be limited by | |
383 <link doc="../http/ngx_http_core_module.xml" id="client_max_body_size"/>, | |
384 and a sufficient buffer size should be set using | |
385 <link doc="../http/ngx_http_core_module.xml" id="client_body_buffer_size"/>. | |
386 The property is available only in the | |
387 <link doc="../http/ngx_http_js_module.xml" id="js_content"/> directive. | |
388 </tag-desc> | |
389 | |
390 <tag-name id="r_request_text"><literal>r.requestText</literal></tag-name> | |
391 <tag-desc> | |
392 the same as <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, | |
393 but returns a <literal>string</literal>. | |
394 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
395 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 396 </tag-desc> |
397 | |
2546
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
398 <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
|
399 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
400 returns an array of key-value pairs |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
401 exactly as they were received from the client |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
402 (<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
|
403 <para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
404 For example, with the following request headers: |
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 Host: localhost |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
407 Foo: bar |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
408 foo: bar2 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
409 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
410 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
|
411 <example> |
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 ['Host', 'localhost'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
414 ['Foo', 'bar'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
415 ['foo', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
416 ] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
417 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
418 All <literal>foo</literal> headers |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
419 can be collected with the syntax: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
420 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
421 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
|
422 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
423 the output will be: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
424 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
425 ['bar', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
426 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
427 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
|
428 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
429 </para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
430 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
431 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
432 <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
|
433 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
434 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
|
435 (<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
|
436 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
|
437 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
438 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
439 |
2628 | 440 <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
|
441 <tag-desc> |
2981
576e06abd683
Marked r.requestBody and r.responseBody as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2958
diff
changeset
|
442 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
|
443 <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
|
444 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
|
445 The <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> |
2628 | 446 or |
447 the <link id="r_response_text"><literal>r.responseText</literal></link> | |
448 property | |
449 should be used instead. | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
450 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
451 |
2628 | 452 <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
|
453 <tag-desc> |
2628 | 454 holds the <link id="r_subrequest">subrequest</link> response body, |
455 read-only | |
456 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
457 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
|
458 <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
|
459 directive. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
460 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
461 |
2628 | 462 <tag-name id="r_response_text"><literal>r.responseText</literal></tag-name> |
463 <tag-desc> | |
464 the same as <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> | |
465 but returns a string | |
466 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
467 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
468 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 469 </tag-desc> |
470 | |
471 <tag-name id="r_return"><literal>r.return(status[, | |
472 string | Buffer])</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
473 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
474 sends the entire response |
2628 | 475 with the specified <literal>status</literal> to the client. |
476 The response can be a string or Buffer | |
477 (<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
|
478 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
479 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
|
480 (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
|
481 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
|
482 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
483 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
484 |
2628 | 485 <tag-name id="r_send"><literal>r.send(string |
486 | Buffer)</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
487 <tag-desc> |
2628 | 488 sends a part of the response body to the client. |
489 The data sent can be a string or Buffer | |
490 (<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
|
491 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
492 |
2663
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
493 <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
|
494 <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
|
495 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
496 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
|
497 (<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
|
498 The actual forwarding happens later, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
499 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
|
500 <para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
501 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
|
502 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
|
503 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
|
504 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
|
505 <list type="tag"> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
506 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
507 <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
|
508 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
509 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
510 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
|
511 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
512 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
513 <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
|
514 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
515 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
516 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
|
517 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
518 </list> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
519 </para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
520 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
|
521 <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
|
522 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
523 |
2571
3e47eecce384
Added id to r.sendHeader in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2570
diff
changeset
|
524 <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
|
525 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
526 sends the HTTP headers to the client |
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 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
529 <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
|
530 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
531 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
|
532 <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
|
533 (<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
|
534 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
535 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
|
536 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
537 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
538 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
539 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
|
540 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
541 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
542 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
543 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
544 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
545 <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
|
546 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
547 status, writable |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
548 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
549 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
550 <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
|
551 <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
|
552 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
553 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
|
554 <literal>options</literal>, and installs |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
555 an optional completion <literal>callback</literal>. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
556 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
557 <para> |
2340
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
558 A |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
559 <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
|
560 shares its input headers with the client request. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
561 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
|
562 <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
|
563 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
564 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
|
565 <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
|
566 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
567 </para> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
568 |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
569 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
570 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
|
571 holds the subrequest arguments string. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
572 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
|
573 an object with the following keys: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
574 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
575 <tag-name><literal>args</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
576 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
577 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
|
578 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
579 <tag-name><literal>body</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
580 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
581 request body, |
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
582 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
|
583 </tag-desc> |
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 <tag-name><literal>method</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
586 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
587 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
|
588 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
589 |
2507 | 590 <tag-name><literal>detached</literal></tag-name> |
591 <tag-desc> | |
592 boolean flag (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), | |
593 if <literal>true</literal>, the created subrequest is a detached subrequest. | |
594 Responses to detached subrequests are ignored. | |
595 Unlike ordinary subrequests, a detached subrequest | |
596 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
|
597 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
|
598 are mutually exclusive. |
2507 | 599 </tag-desc> |
600 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
601 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
602 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
603 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
604 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
605 The completion <literal>callback</literal> receives |
2997
adecad3d7039
Added link to subrequest response object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2989
diff
changeset
|
606 a <link id="http">subrequest response object</link> with methods and properties |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
607 identical to the parent request object. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
608 </para> |
2484
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
609 |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
610 <para> |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
611 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
|
612 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
|
613 the <literal>Promise</literal> object |
2997
adecad3d7039
Added link to subrequest response object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2989
diff
changeset
|
614 that resolves to the <link id="http">subrequest response object</link> |
adecad3d7039
Added link to subrequest response object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2989
diff
changeset
|
615 is returned. |
2484
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
616 </para> |
2998
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
617 |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
618 <para> |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
619 For example, to view all response headers in the subrequest: |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
620 <example> |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
621 async function handler(r) [ |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
622 let reply = await r.subrequest('/path'); |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
623 |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
624 for (var h in reply.headersOut) { |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
625 r.log(`${h}: ${reply.headersOut[h]}`); |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
626 } |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
627 |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
628 r.return(200); |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
629 } |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
630 </example> |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
631 </para> |
050d2e099e16
Added example to r.subrequest in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2997
diff
changeset
|
632 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
633 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
634 |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
635 <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
|
636 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
637 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
|
638 in request, |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
639 <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
|
640 read-only |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
641 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
642 |
2628 | 643 <tag-name id="r_raw_variables"><literal>r.rawVariables{}</literal></tag-name> |
644 <tag-desc> | |
645 nginx <link id="r_variables">variables</link> as Buffers, | |
646 writable | |
647 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
648 </tag-desc> | |
649 | |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
650 <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
|
651 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
652 <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
|
653 (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
|
654 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
655 <para> |
2926
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
656 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
|
657 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
|
658 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
659 r.variables['foo'] |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
660 r.variables.foo |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
661 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
662 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
|
663 and unreferenced variables differently. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
664 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
|
665 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
|
666 For example, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
667 <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
|
668 variable is only accessed from njs, |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
669 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
|
670 But, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
671 <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
|
672 is referenced, for example: |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
673 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
674 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
|
675 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
676 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
|
677 </para> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
678 |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
679 <para> |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
680 A variable is writable if: |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
681 <list type="bullet"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
682 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
683 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
684 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
|
685 <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
|
686 <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
|
687 (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
|
688 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
689 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
690 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
691 it is referenced in nginx configuration file |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
692 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
693 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
694 </list> |
2689
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
695 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
|
696 <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
|
697 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
698 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
699 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
700 <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
|
701 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
702 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
703 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
|
704 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
705 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
706 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
707 <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
|
708 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
709 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
|
710 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
711 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
712 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
713 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
714 </list> |
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 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
717 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
718 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
719 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
720 <section id="stream" name="Stream Session"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
721 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
722 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
723 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
724 <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
|
725 <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
|
726 <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
|
727 <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
|
728 <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
|
729 <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
|
730 <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
|
731 <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
|
732 <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
|
733 <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
|
734 <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
|
735 <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
|
736 <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
|
737 <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
|
738 <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
|
739 <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
|
740 <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
|
741 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
742 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
743 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
744 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
745 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
|
746 <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
|
747 module. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
748 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
|
749 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
750 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
751 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
752 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
753 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
754 <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
|
755 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
756 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
757 <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
|
758 (<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
|
759 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
760 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
761 <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
|
762 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
763 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
764 <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
|
765 (<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
|
766 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
767 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
768 <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
|
769 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
770 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
771 <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
|
772 (<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
|
773 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
774 |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
775 <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
|
776 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
777 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
|
778 <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
|
779 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
|
780 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
|
781 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
|
782 <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
|
783 <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
|
784 are processed |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
785 (<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
|
786 <para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
787 Possible code values: |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
788 <list type="bullet"> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
789 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
790 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
791 <literal>0</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
792 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
|
793 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
794 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
795 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
796 <literal>-5</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
797 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
|
798 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
799 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
800 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
801 <literal>403</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
802 access is forbidden |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
803 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
804 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
805 </list> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
806 </para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
807 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
|
808 <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
|
809 or |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
810 <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
|
811 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
812 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
813 <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
|
814 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
815 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
|
816 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
|
817 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
818 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
819 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
820 <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
|
821 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
822 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
|
823 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
824 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
825 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
826 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
827 <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
|
828 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
829 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
|
830 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
|
831 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
832 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
833 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
834 <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
|
835 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
836 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
|
837 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
838 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
839 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
840 |
2881
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
841 <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
|
842 <tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
843 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
|
844 (<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
|
845 </tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
846 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
847 <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
|
848 <value>callback</value>)</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
849 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
850 registers a <literal>callback</literal> |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
851 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
|
852 (<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
|
853 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
854 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
855 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
|
856 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
857 <tag-name><literal>upload</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
858 <tag-desc> |
2628 | 859 new data (string) from a client |
2247
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 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
862 <tag-name><literal>download</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
863 <tag-desc> |
2628 | 864 new data (string) to a client |
865 </tag-desc> | |
866 | |
867 <tag-name><literal>upstream</literal></tag-name> | |
868 <tag-desc> | |
869 new data (Buffer) from a client | |
870 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
871 </tag-desc> | |
872 | |
873 <tag-name><literal>downstream</literal></tag-name> | |
874 <tag-desc> | |
875 new data (Buffer) to a client | |
876 (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
|
877 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
878 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
879 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
880 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
881 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
882 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
883 The completion callback has the following prototype: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
884 <literal>callback(data, flags)</literal>, where |
2628 | 885 <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
|
886 <literal>flags</literal> is an object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
887 with the following properties: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
888 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
889 <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
|
890 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
891 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
|
892 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
893 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
894 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
895 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
896 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
897 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
898 <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
|
899 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
900 client address, read-only |
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 |
2628 | 903 <tag-name id="s_raw_variables"><literal>s.rawVariables</literal></tag-name> |
904 <tag-desc> | |
905 nginx <link id="s_variables">variables</link> as Buffers, | |
906 writable | |
907 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
908 </tag-desc> | |
909 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
910 <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
|
911 <value>options</value>])</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
912 <tag-desc> |
2667
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
913 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
|
914 the forward direction: |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
915 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
|
916 (<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
|
917 The actual forwarding happens later, |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
918 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
|
919 <para> |
2628 | 920 The data can be a string or Buffer |
921 (<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
|
922 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
|
923 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
|
924 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
|
925 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
926 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
927 <tag-name><literal>last</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
928 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
929 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
930 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
|
931 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
932 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
933 <tag-name><literal>flush</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
934 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
935 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
936 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
|
937 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
938 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
939 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
940 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
|
941 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
942 |
2902
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
943 <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
|
944 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
945 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
|
946 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
|
947 (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
|
948 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
949 |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
950 <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
|
951 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
952 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
|
953 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
|
954 (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
|
955 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
956 |
2665
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
957 <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
|
958 <tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
959 session status code, an alias to the |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
960 <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
|
961 variable, |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
962 read only |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
963 (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
|
964 </tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
965 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
966 <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
|
967 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
968 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
|
969 <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
|
970 (<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
|
971 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
972 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
|
973 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
974 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
975 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
976 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
|
977 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
978 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
979 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
980 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
981 |
2338
39ac205f90b7
Documented that r.variables{} and s.variables{} are writable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2337
diff
changeset
|
982 <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
|
983 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
984 <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
|
985 (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
|
986 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
|
987 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
|
988 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
|
989 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
990 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
991 <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
|
992 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
993 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
|
994 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
|
995 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
996 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
997 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
998 <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
|
999 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1000 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
|
1001 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1002 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1003 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1004 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1005 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1006 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1007 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1008 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1009 |
2628 | 1010 |
3014
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1011 <section id="periodic_session" name="Periodic Session"> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1012 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1013 <para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1014 <table width="100%"> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1015 <tr><td><link id="periodic_session_raw_variables"><literal>PeriodicSession.rawVariables{}</literal></link></td></tr> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1016 <tr><td><link id="periodic_session_variables"><literal>PeriodicSession.variables{}</literal></link></td></tr> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1017 </table> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1018 </para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1019 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1020 <para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1021 The <literal>Periodic Session</literal> object is provided as the first argument |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1022 for the <literal>js_periodic</literal> handler for |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1023 <link doc="../http/ngx_http_js_module.xml" id="js_periodic">http</link> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1024 and |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1025 <link doc="../stream/ngx_stream_js_module.xml" id="js_periodic">stream</link> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1026 (since <link doc="changes.xml" id="njs0.8.1">0.8.1</link>). |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1027 </para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1028 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1029 <para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1030 <list type="tag"> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1031 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1032 <tag-name id="periodic_session_raw_variables"><literal>PeriodicSession.rawVariables{}</literal></tag-name> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1033 <tag-desc> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1034 nginx <link id="periodic_session_variables">variables</link> as Buffers, |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1035 writable. |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1036 </tag-desc> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1037 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1038 <tag-name id="periodic_session_variables"><literal>PeriodicSession.variables{}</literal></tag-name> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1039 <tag-desc> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1040 <link doc="../varindex.xml">nginx variables</link> object, writable. |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1041 </tag-desc> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1042 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1043 </list> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1044 </para> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1045 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1046 </section> |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1047 |
c0a4a4a55e45
Documented Periodic Session object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3009
diff
changeset
|
1048 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1049 <section id="headers" name="Headers"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1050 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1051 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1052 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1053 <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
|
1054 <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
|
1055 <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
|
1056 <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
|
1057 <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
|
1058 <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
|
1059 <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
|
1060 <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
|
1061 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1062 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1063 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1064 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1065 The <literal>Headers</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1066 <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
|
1067 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
|
1068 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1069 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1070 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1071 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
|
1072 <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
|
1073 (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
|
1074 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1075 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1076 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1077 <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
|
1078 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1079 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1080 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1081 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1082 <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
|
1083 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1084 An object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1085 prepopulating the <literal>Headers</literal> object, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1086 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1087 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
|
1088 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
|
1089 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1090 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1091 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1092 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1093 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1094 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1095 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1096 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1097 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1098 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
|
1099 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1100 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1101 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1102 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1103 <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
|
1104 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1105 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
|
1106 <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1107 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
|
1108 (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
|
1109 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1110 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1111 <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
|
1112 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1113 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
|
1114 (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
|
1115 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1116 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1117 <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
|
1118 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1119 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
|
1120 separated by a comma and a space. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1121 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1122 |
2941
8f50cc590cd7
Updated njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2935
diff
changeset
|
1123 <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
|
1124 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1125 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
|
1126 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1127 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1128 <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
|
1129 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1130 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
|
1131 in the <literal>Headers</literal> object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1132 (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
|
1133 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1134 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1135 <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
|
1136 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1137 Returns a boolean value |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1138 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
|
1139 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1140 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1141 <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
|
1142 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1143 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
|
1144 the <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1145 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
|
1146 (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
|
1147 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1148 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1149 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1150 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1151 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1152 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1153 |
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 <section id="request" name="Request"> |
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 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1158 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1159 <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
|
1160 <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
|
1161 <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
|
1162 <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
|
1163 <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
|
1164 <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
|
1165 <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
|
1166 <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
|
1167 <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
|
1168 <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
|
1169 <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
|
1170 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1171 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1172 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1173 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1174 The <literal>Request</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1175 <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
|
1176 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
|
1177 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1178 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1179 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1180 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
|
1181 <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
|
1182 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1183 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1184 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1185 <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
|
1186 <value>options</value>]])</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1187 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1188 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1189 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
|
1190 that can be passed later to |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1191 <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
|
1192 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
|
1193 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
|
1194 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
|
1195 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
|
1196 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1197 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1198 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1199 <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
|
1200 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1201 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
|
1202 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1203 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1204 <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
|
1205 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1206 The response headers object— |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1207 the object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1208 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
|
1209 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1210 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
|
1211 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
|
1212 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1213 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1214 <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
|
1215 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1216 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
|
1217 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1218 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1219 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1220 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1221 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1222 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1223 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1224 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1225 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1226 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
|
1227 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1228 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1229 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1230 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1231 <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
|
1232 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1233 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
|
1234 an <literal>ArrayBuffer</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1235 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1236 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1237 <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
|
1238 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1239 A boolean value, <literal>true</literal> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1240 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
|
1241 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1242 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1243 <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
|
1244 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1245 Contains the cache mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1246 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1247 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1248 <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
|
1249 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1250 Contains the credentials of the request, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1251 by default is <literal>same-origin</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1252 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1253 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1254 <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
|
1255 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1256 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
|
1257 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1258 <link id="request"><literal>Request</literal></link>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1259 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1260 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1261 <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
|
1262 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1263 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
|
1264 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
|
1265 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1266 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1267 <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
|
1268 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1269 Contains the request method. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1270 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1271 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1272 <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
|
1273 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1274 Contains the mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1275 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1276 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1277 <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
|
1278 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1279 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
|
1280 string representation of the request body. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1281 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1282 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1283 <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
|
1284 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1285 Contains the URL of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1286 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1287 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1288 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1289 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1290 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1291 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1292 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1293 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1294 <section id="response" name="Response"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1295 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1296 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1297 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1298 <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
|
1299 <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
|
1300 <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
|
1301 <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
|
1302 <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
|
1303 <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
|
1304 <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
|
1305 <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
|
1306 <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
|
1307 <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
|
1308 <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
|
1309 <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
|
1310 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1311 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1312 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1313 <para> |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1314 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
|
1315 <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
|
1316 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1317 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1318 <para> |
2988
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1319 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
|
1320 <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
|
1321 (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
|
1322 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1323 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1324 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1325 <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
|
1326 <value>options</value>]])</literal></tag-name> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1327 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1328 Creates a <literal>Response</literal> object. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1329 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
|
1330 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
|
1331 by default is <literal>null</literal>. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1332 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
|
1333 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
|
1334 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1335 <list type="tag"> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1336 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1337 <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
|
1338 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1339 The response headers object— |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1340 the object containing HTTP headers for |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1341 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
|
1342 can be a <literal>string</literal>, |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1343 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
|
1344 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
|
1345 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1346 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1347 <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
|
1348 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1349 The status code of the response. |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1350 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1351 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1352 <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
|
1353 <tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1354 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
|
1355 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1356 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1357 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1358 </tag-desc> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1359 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1360 </list> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1361 </para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1362 |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1363 <para> |
8899986c3622
Documented Headers, Request, Response constructors in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2987
diff
changeset
|
1364 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
|
1365 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
|
1366 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1367 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1368 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1369 <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
|
1370 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1371 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
|
1372 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
|
1373 an <literal>ArrayBuffer</literal>. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1374 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1375 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1376 <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
|
1377 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1378 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1379 if the body was read. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1380 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1381 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1382 <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
|
1383 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1384 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
|
1385 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1386 <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
|
1387 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1388 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1389 <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
|
1390 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1391 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
|
1392 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
|
1393 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
|
1394 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1395 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1396 <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
|
1397 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1398 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1399 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
|
1400 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1401 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1402 <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
|
1403 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1404 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1405 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
|
1406 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1407 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1408 <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
|
1409 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1410 The status code of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1411 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1412 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1413 <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
|
1414 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1415 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
|
1416 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1417 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1418 <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
|
1419 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1420 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
|
1421 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
|
1422 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1423 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1424 <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
|
1425 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1426 The type of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1427 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1428 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1429 <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
|
1430 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1431 The URL of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1432 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1433 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1434 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1435 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1436 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1437 </section> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1438 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1439 |
2628 | 1440 <section id="ngx" name="ngx"> |
1441 | |
1442 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1443 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1444 <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
|
1445 <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
|
1446 <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
|
1447 <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
|
1448 <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
|
1449 <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
|
1450 <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
|
1451 <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
|
1452 <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
|
1453 <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
|
1454 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1455 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1456 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1457 <para> |
2628 | 1458 The <literal>ngx</literal> global object is available |
1459 since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>. | |
1460 <list type="tag"> | |
1461 | |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1462 <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
|
1463 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1464 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
|
1465 <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
|
1466 argument |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1467 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
|
1468 by default is <literal>""</literal> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1469 (<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
|
1470 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1471 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1472 <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
|
1473 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1474 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
|
1475 (<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
|
1476 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1477 |
2910
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1478 <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
|
1479 <tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1480 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
|
1481 <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
|
1482 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
|
1483 (<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
|
1484 </tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1485 |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1486 <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
|
1487 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1488 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
|
1489 <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
|
1490 (<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
|
1491 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1492 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1493 <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
|
1494 [<value>options</value>])</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1495 <tag-desc> |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1496 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1497 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
|
1498 (<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
|
1499 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
|
1500 (<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
|
1501 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
|
1502 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
|
1503 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
|
1504 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
|
1505 redirects are not handled. |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1506 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1507 |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1508 <para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1509 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
|
1510 it is determined using a |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1511 <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
|
1512 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
|
1513 <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
|
1514 directive should be configured |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1515 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
|
1516 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1517 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1518 <para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1519 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
|
1520 with the following keys: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1521 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1522 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1523 <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
|
1524 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1525 request body, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1526 by default is empty |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1527 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1528 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1529 <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
|
1530 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1531 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
|
1532 by default is <literal>4096</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1533 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1534 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1535 <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
|
1536 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1537 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
|
1538 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1539 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1540 <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
|
1541 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1542 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
|
1543 by default is <literal>32768</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1544 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1545 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1546 <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
|
1547 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1548 HTTP method, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1549 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
|
1550 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1551 |
2775
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1552 <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
|
1553 <tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1554 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
|
1555 by default is <literal>true</literal> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1556 (<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
|
1557 </tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1558 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1559 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1560 Example: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1561 <example> |
2840
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1562 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
|
1563 let body = await reply.text(); |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1564 |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1565 r.return(200, body); |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1566 </example> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1567 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1568 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1569 |
2628 | 1570 <tag-name id="ngx_log"><literal>ngx.log</literal>(<value>level</value>, |
1571 <value>message</value>)</tag-name> | |
1572 <tag-desc> | |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1573 writes a message to the error log with the specified level of logging. |
2628 | 1574 The <value>level</value> parameter specifies one of the log levels, |
1575 the <value>message</value> parameter can be a string or Buffer. | |
1576 The following log levels can be specified: | |
1577 <literal>ngx.INFO</literal>, | |
1578 <literal>ngx.WARN</literal>, and | |
1579 <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
|
1580 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1581 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1582 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1583 <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
|
1584 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1585 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
|
1586 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1587 </para> |
2628 | 1588 </tag-desc> |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1589 |
2983
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1590 <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
|
1591 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1592 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
|
1593 <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
|
1594 a directory that keeps server files |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1595 (<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
|
1596 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1597 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1598 <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
|
1599 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1600 a string containing nginx version, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1601 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
|
1602 (<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
|
1603 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1604 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1605 <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
|
1606 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1607 a number containing nginx version, |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1608 for example: <literal>1025000</literal> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1609 (<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
|
1610 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1611 |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1612 <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
|
1613 <tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1614 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
|
1615 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
|
1616 <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
|
1617 (<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
|
1618 </tag-desc> |
67dd348c9757
Documented new global nginx properties in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2982
diff
changeset
|
1619 |
2628 | 1620 </list> |
1621 </para> | |
1622 | |
1623 </section> | |
1624 | |
3007
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1625 <section id="ngx_shared" name="ngx.shared"> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1626 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1627 <para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1628 The <literal>ngx.shared</literal> global object is available |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1629 since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1630 </para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1631 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1632 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1633 <section id="dict" name="SharedDict"> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1634 <para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1635 <table width="100%"> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1636 <tr><td><link id="dict_add"><literal>ngx.shared.SharedDict.add()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1637 <tr><td><link id="dict_capacity"><literal>ngx.shared.SharedDict.capacity</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1638 <tr><td><link id="dict_clear"><literal>ngx.shared.SharedDict.clear()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1639 <tr><td><link id="dict_delete"><literal>ngx.shared.SharedDict.delete()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1640 <tr><td><link id="dict_freespace"><literal>ngx.shared.SharedDict.freeSpace()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1641 <tr><td><link id="dict_get"><literal>ngx.shared.SharedDict.get()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1642 <tr><td><link id="dict_has"><literal>ngx.shared.SharedDict.has()</literal></link></td></tr> |
3009
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1643 <tr><td><link id="dict_incr"><literal>ngx.shared.SharedDict.incr()</literal></link></td></tr> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1644 <tr><td><link id="dict_items"><literal>ngx.shared.SharedDict.items()</literal></link></td></tr> |
3007
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1645 <tr><td><link id="dict_keys"><literal>ngx.shared.SharedDict.keys()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1646 <tr><td><link id="dict_name"><literal>ngx.shared.SharedDict.name</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1647 <tr><td><link id="dict_pop"><literal>ngx.shared.SharedDict.pop()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1648 <tr><td><link id="dict_replace"><literal>ngx.shared.SharedDict.replace()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1649 <tr><td><link id="dict_set"><literal>ngx.shared.SharedDict.set()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1650 <tr><td><link id="dict_size"><literal>ngx.shared.SharedDict.size()</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1651 <tr><td><link id="dict_type"><literal>ngx.shared.SharedDict.type</literal></link></td></tr> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1652 </table> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1653 </para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1654 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1655 <para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1656 The shared dictionary object is available |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1657 since <link doc="changes.xml" id="njs0.8.0">0.8.0</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1658 The shared dictionary name, type, and size |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1659 are set with the <literal>js_shared_dict_zone</literal> directive in |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1660 <link doc="../http/ngx_http_js_module.xml" id="js_shared_dict_zone">http</link> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1661 or |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1662 <link doc="../stream/ngx_stream_js_module.xml" id="js_shared_dict_zone">stream</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1663 </para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1664 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1665 <para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1666 A <literal>SharedDict()</literal> object |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1667 has the following properties and methods: |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1668 <list type="tag"> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1669 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1670 <tag-name id="dict_add"><literal>ngx.shared.SharedDict.add(<value>key</value>, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1671 <value>value</value>)</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1672 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1673 Sets the <literal>value</literal> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1674 for the specified <literal>key</literal> in the dictionary |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1675 only if the key does not exist yet. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1676 The <literal>key</literal> is a string representing |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1677 the key of the item to add, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1678 the <literal>value</literal> is the value of the item to add. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1679 Returns <literal>true</literal> if the value has been successfully added |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1680 to the <literal>SharedDict</literal> dictionary, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1681 <literal>false</literal> if the key already exists in the dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1682 Throws <literal>SharedMemoryError</literal> if |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1683 there is not enough free space in the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1684 Throws <literal>TypeError</literal> if the <literal>value</literal> is |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1685 of a different type than expected by this dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1686 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1687 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1688 <tag-name id="dict_capacity"><literal>ngx.shared.SharedDict.capacity</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1689 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1690 Returns the capacity of the <literal>SharedDict</literal> dictionary, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1691 corresponds to the <literal>size</literal> parameter of |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1692 <literal>js_shared_dict_zone</literal> directive in |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1693 <link doc="../http/ngx_http_js_module.xml" id="js_shared_dict_zone">http</link> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1694 or |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1695 <link doc="../stream/ngx_stream_js_module.xml" id="js_shared_dict_zone">stream</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1696 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1697 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1698 <tag-name id="dict_clear"><literal>ngx.shared.SharedDict.clear()</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1699 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1700 Removes all items from the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1701 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1702 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1703 <tag-name id="dict_delete"><literal>ngx.shared.SharedDict.delete(<value>key</value>)</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1704 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1705 Removes the item associated with the specified key |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1706 from the <literal>SharedDict</literal> dictionary, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1707 <literal>true</literal> if the item in the dictionary existed and was removed, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1708 <literal>false</literal> otherwise. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1709 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1710 |
3009
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1711 <tag-name id="dict_freespace"><literal>ngx.shared.SharedDict.freeSpace()</literal></tag-name> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1712 <tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1713 Returns the free page size in bytes. |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1714 If the size is zero, the <literal>SharedDict</literal> dictionary |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1715 will still accept new values if there is space in the occupied pages. |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1716 </tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1717 |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1718 <tag-name id="dict_get"><literal>ngx.shared.SharedDict.get(<value>key</value>)</literal></tag-name> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1719 <tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1720 Retrieves the item by its <literal>key</literal>, |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1721 returns the value associated with the <literal>key</literal> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1722 or <literal>undefined</literal> if there is none. |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1723 </tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1724 |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1725 <tag-name id="dict_has"><literal>ngx.shared.SharedDict.has(<value>key</value>)</literal></tag-name> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1726 <tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1727 Searches for an item by its <literal>key</literal>, |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1728 returns <literal>true</literal> if such item exists or |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1729 <literal>false</literal> otherwise. |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1730 </tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1731 |
3007
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1732 <tag-name id="dict_incr"><literal>ngx.shared.SharedDict.incr(<value>key</value>,<value>delta</value>[,<value>init</value>])</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1733 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1734 Increments the integer value associated with the <literal>key</literal> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1735 by <literal>delta</literal>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1736 If the key does not exist, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1737 the item will be initialized to <literal>init</literal>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1738 The <literal>key</literal> is a string, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1739 the <literal>delta</literal> is the number |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1740 to increment or decrement the value by, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1741 the <literal>init</literal> is a number to initialize the item with |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1742 if it does not exist, by default is <literal>0</literal>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1743 Returns the new value. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1744 Throws <literal>SharedMemoryError</literal> if |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1745 there is not enough free space in the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1746 Throws <literal>TypeError</literal> if this dictionary does not expect numbers. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1747 <note> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1748 This method can be used only if the dictionary type was declared with |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1749 <literal>type=number</literal> parameter of the |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1750 <literal>js_shared_dict_zone</literal> directive in |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1751 <link doc="../http/ngx_http_js_module.xml" id="js_shared_dict_zone">http</link> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1752 or |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1753 <link doc="../stream/ngx_stream_js_module.xml" id="js_shared_dict_zone">stream</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1754 </note> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1755 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1756 |
3009
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1757 <tag-name id="dict_items"><literal>ngx.shared.SharedDict.items([<value>maxCount</value>])</literal></tag-name> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1758 <tag-desc> |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1759 Returns an array of the <literal>SharedDict</literal> dictionary |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1760 key-value items (since <link doc="changes.xml" id="njs0.8.1">0.8.1</link>). |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1761 The <literal>maxCount</literal> parameter |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1762 sets maximum number of items to retrieve, |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1763 by default is <literal>1024</literal>. |
2e8c1384d211
Documented ngx.shared.SharedDict.items in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3007
diff
changeset
|
1764 |
3007
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1765 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1766 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1767 <tag-name id="dict_keys"><literal>ngx.shared.SharedDict.keys([<value>maxCount</value>])</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1768 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1769 Returns an array of the <literal>SharedDict</literal> dictionary keys. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1770 The <literal>maxCount</literal> parameter |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1771 sets maximum number of keys to retrieve, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1772 by default is <literal>1024</literal>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1773 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1774 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1775 <tag-name id="dict_name"><literal>ngx.shared.SharedDict.name</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1776 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1777 Returns the name of the <literal>SharedDict</literal> dictionary, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1778 corresponds to the <literal>zone=</literal> parameter of |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1779 <literal>js_shared_dict_zone</literal> directive in |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1780 <link doc="../http/ngx_http_js_module.xml" id="js_shared_dict_zone">http</link> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1781 or |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1782 <link doc="../stream/ngx_stream_js_module.xml" id="js_shared_dict_zone">stream</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1783 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1784 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1785 <tag-name id="dict_pop"><literal>ngx.shared.SharedDict.pop(<value>key</value>)</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1786 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1787 Removes the item associated with the specified <literal>key</literal> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1788 from the <literal>SharedDict</literal> dictionary, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1789 returns the value associated with the <literal>key</literal> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1790 or <literal>undefined</literal> if there is none. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1791 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1792 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1793 <tag-name id="dict_replace"><literal>ngx.shared.SharedDict.replace(<value>key</value>, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1794 <value>value</value>)</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1795 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1796 Replaces the <literal>value</literal> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1797 for the specified <literal>key</literal> only if the key already exists, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1798 returns <literal>true</literal> if the value was successfully replaced, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1799 <literal>false</literal> if the key does not exist |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1800 in the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1801 Throws <literal>SharedMemoryError</literal> if |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1802 there is not enough free space in the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1803 Throws <literal>TypeError</literal> if the <literal>value</literal> is |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1804 of a different type than expected by this dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1805 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1806 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1807 <tag-name id="dict_set"><literal>ngx.shared.SharedDict.set(<value>key</value>, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1808 <value>value</value>)</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1809 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1810 Sets the <literal>value</literal> for the specified <literal>key</literal>, |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1811 returns this <literal>SharedDict</literal> dictionary (for method chaining). |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1812 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1813 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1814 <tag-name id="dict_size"><literal>ngx.shared.SharedDict.size()</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1815 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1816 Returns the number of items for the <literal>SharedDict</literal> dictionary. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1817 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1818 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1819 <tag-name id="dict_type"><literal>ngx.shared.SharedDict.type</literal></tag-name> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1820 <tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1821 Returns <literal>string</literal> or <literal>number</literal> that |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1822 corresponds to the <literal>SharedDict</literal> dictionary type |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1823 set by the <literal>type=</literal> parameter of |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1824 <literal>js_shared_dict_zone</literal> directive in |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1825 <link doc="../http/ngx_http_js_module.xml" id="js_shared_dict_zone">http</link> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1826 or |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1827 <link doc="../stream/ngx_stream_js_module.xml" id="js_shared_dict_zone">stream</link>. |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1828 </tag-desc> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1829 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1830 </list> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1831 </para> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1832 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1833 </section> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1834 |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1835 </section> |
3184864bbb3f
Added SharedDict to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3001
diff
changeset
|
1836 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1837 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1838 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1839 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
1840 <section id="builtin_objects" name="built-in objects"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1841 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1842 |
3015
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1843 <section id="console" name="console"> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1844 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1845 <para> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1846 <table width="100%"> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1847 <tr><td><link id="console_error"><literal>console.error()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1848 <tr><td><link id="console_info"><literal>console.info()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1849 <tr><td><link id="console_log"><literal>console.log()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1850 <tr><td><link id="console_time"><literal>console.time()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1851 <tr><td><link id="console_time_end"><literal>console.timeEnd()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1852 <tr><td><link id="console_warn"><literal>console.warn()</literal></link></td></tr> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1853 </table> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1854 </para> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1855 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1856 <para> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1857 The <literal>console</literal> object is available |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1858 in nginx since <link doc="changes.xml" id="njs0.8.2">0.8.2</link>, |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1859 in CLI since <link doc="changes.xml" id="njs0.2.6">0.2.6</link>. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1860 <list type="tag"> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1861 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1862 <tag-name id="console_error"><literal>console.error(<value>msg</value>[, <value>msg2</value> ...])</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1863 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1864 Outputs one or more error messages. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1865 The message may be a string or an object. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1866 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1867 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1868 <tag-name id="console_info"><literal>console.info(<value>msg</value>[, <value>msg2</value> ...])</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1869 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1870 Outputs one or more info messages. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1871 The message may be a string or an object. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1872 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1873 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1874 <tag-name id="console_log"><literal>console.log(<value>msg</value>[, <value>msg2</value> ...])</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1875 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1876 Outputs one or more log messages. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1877 The message may be a string or an object. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1878 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1879 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1880 <tag-name id="console_time"><literal>console.time(<value>label</value>)</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1881 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1882 Starts a timer that can track how long an operation takes. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1883 The <literal>label</literal> parameter allows naming different timers. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1884 If <link id="console_time_end"><literal>console.timeEnd()</literal></link> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1885 with the same name is called, |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1886 the time that elapsed since the timer was started will be output, |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1887 in milliseconds. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1888 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1889 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1890 <tag-name id="console_time_end"><literal>console.timeEnd(<value>label</value>)</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1891 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1892 Stops a timer previously started by |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1893 <link id="console_time"><literal>console.time()</literal></link> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1894 The <literal>label</literal> parameter allows naming different timers. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1895 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1896 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1897 <tag-name id="console_warn"><literal>console.warn(<value>msg</value>[, <value>msg2</value> ...])</literal></tag-name> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1898 <tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1899 Outputs one or more warning messages. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1900 The message may be a string or an object. |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1901 </tag-desc> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1902 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1903 </list> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1904 </para> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1905 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1906 </section> |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1907 |
3a85326ed38c
Documented Console object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3014
diff
changeset
|
1908 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1909 <section id="builtin_crypto" name="crypto"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1910 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1911 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1912 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1913 <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
|
1914 <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
|
1915 <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
|
1916 <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
|
1917 <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
|
1918 <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
|
1919 <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
|
1920 <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
|
1921 <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
|
1922 <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
|
1923 <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
|
1924 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1925 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1926 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
1927 <para> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1928 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
|
1929 that allows using cryptographic functionality |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1930 (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
|
1931 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1932 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1933 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1934 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1935 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1936 <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
|
1937 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1938 Gets cryptographically strong random values. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1939 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
|
1940 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
|
1941 Possible values: |
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 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1944 <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
|
1945 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1946 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1947 <literal>Int8Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1948 <literal>Int16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1949 <literal>Uint16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1950 <literal>Int32Array</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1951 <literal>Uint32Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1952 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1953 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1954 |
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_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
|
1958 <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
|
1959 <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
|
1960 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1961 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
|
1962 using the provided |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1963 <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
|
1964 <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
|
1965 Returns a <literal>Promise</literal> that fulfills with |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1966 an <literal>ArrayBuffer</literal> containing the ciphertext. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1967 Possible values: |
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 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1970 <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
|
1971 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1972 an object that specifies |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1973 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
|
1974 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1975 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1976 <listitem id="rsa_oaep_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1977 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1978 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1979 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1980 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1981 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1982 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1983 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1984 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1985 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1986 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1987 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1988 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1989 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1990 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1991 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1992 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1993 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1994 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1995 <listitem id="aes_ctr_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1996 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1997 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1998 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1999 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2000 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2001 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2002 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2003 should be set to <literal>AES-CTR</literal> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2006 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2007 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2008 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2009 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2010 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2011 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2012 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
|
2013 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
|
2014 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2015 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2016 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
|
2017 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
|
2018 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2019 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2020 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2021 <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
|
2022 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2023 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
|
2024 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2025 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2026 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2027 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2028 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2029 <listitem id="aes_cbc_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2030 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
|
2031 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2032 <list type="bullet"> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2035 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2036 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2037 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2038 |
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 <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
|
2041 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2042 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2043 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2044 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2045 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2046 However, it need not be secret, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2047 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
|
2048 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2049 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2050 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2051 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2052 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2053 <listitem id="aes_gcm_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2054 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
|
2055 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2056 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2057 |
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 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2060 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2061 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2062 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2063 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2064 <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
|
2065 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2066 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2067 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2068 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2069 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
|
2070 </listitem> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2073 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2074 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2075 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2076 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2077 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2078 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
|
2079 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2080 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
|
2081 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2082 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
|
2083 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2084 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2085 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2086 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
|
2087 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2088 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2089 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2090 <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
|
2091 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
|
2092 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
|
2093 and used for authentication in the corresponding decryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2094 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2095 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2096 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2097 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2098 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2099 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2100 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2101 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2102 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
|
2103 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2104 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2105 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2106 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2107 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2108 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2109 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2110 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2111 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2112 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2113 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2114 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2115 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2116 </list> |
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 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2119 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2120 <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
|
2121 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2122 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
|
2123 the key to be used for encryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2124 </tag-desc> |
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 <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
|
2127 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2128 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2129 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2130 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2131 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2132 that contains |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2133 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
|
2134 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2135 </list> |
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 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2138 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2139 <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
|
2140 <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
|
2141 <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
|
2142 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2143 Decrypts encrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2144 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
|
2145 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2146 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2147 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2148 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2149 <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
|
2150 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2151 an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2152 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
|
2153 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
|
2154 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
|
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2158 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2159 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2160 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2161 <list type="bullet"> |
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>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2165 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2166 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2167 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2168 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2169 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2170 </para> |
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 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2173 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2174 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2175 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2176 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2177 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2178 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2179 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2180 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2181 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2182 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2183 should be set to <literal>AES-CTR</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2184 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2185 |
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 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2188 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2189 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2190 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2191 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2192 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
|
2193 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
|
2194 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2195 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2196 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
|
2197 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
|
2198 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2199 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2200 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2201 <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
|
2202 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2203 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
|
2204 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2205 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2206 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2207 </listitem> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2210 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
|
2211 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2212 <list type="bullet"> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2215 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2216 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2217 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2218 |
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 <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
|
2221 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2222 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2223 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2224 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2225 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2226 However, it need not be secret |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2227 (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
|
2228 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2229 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2230 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2231 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2232 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2233 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2234 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
|
2235 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2236 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2237 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2238 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2239 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2240 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2241 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2242 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2243 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2244 <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
|
2245 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2246 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2247 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2248 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2249 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
|
2250 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2251 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2252 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2253 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2254 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2255 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2256 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2257 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2258 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
|
2259 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2260 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
|
2261 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2262 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
|
2263 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2264 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2265 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2266 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
|
2267 </listitem> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2270 <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
|
2271 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
|
2272 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
|
2273 and used for authentication in the corresponding decryption. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2274 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2275 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2276 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2277 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2278 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2279 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2280 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2281 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2282 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
|
2283 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2284 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2285 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2286 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2287 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2288 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2289 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2290 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2291 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2292 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2293 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2294 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2295 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2296 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2297 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2298 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2299 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2300 <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
|
2301 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2302 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
|
2303 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
|
2304 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
|
2305 <literal>privateKey</literal> property of the |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
2306 <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
|
2307 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2308 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2309 <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
|
2310 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2311 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2312 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2313 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2314 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2315 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
|
2316 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2317 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2318 |
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 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
|
2322 <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
|
2323 <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
|
2324 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2325 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
|
2326 Returns a <literal>Promise</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2327 which will be fulfilled with an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2328 <literal>ArrayBuffer</literal> that contains the derived bits. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2329 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2330 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2331 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2332 <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
|
2333 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2334 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
|
2335 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2336 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2337 <listitem id="hkdf_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2338 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2339 pass the object with the following keys: |
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="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2342 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2343 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2344 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2345 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2346 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2347 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2348 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2349 <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
|
2350 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2351 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2352 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2353 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2354 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2355 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2356 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2357 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2358 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2359 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2360 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2361 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2362 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
|
2363 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
|
2364 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2365 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2366 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2367 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2368 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2369 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2370 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2371 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2372 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2373 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
|
2374 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2375 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2376 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
|
2377 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2378 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2379 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2380 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2381 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2382 <listitem id="pbkdf2_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2383 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2384 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2385 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2386 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2387 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2388 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2389 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2390 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2391 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2392 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2393 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2394 <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
|
2395 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2396 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2397 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2398 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2399 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2400 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2401 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2402 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2403 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2404 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2405 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2406 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2407 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2408 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
|
2409 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2410 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2411 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2412 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2413 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2414 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
|
2415 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2416 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2417 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2418 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2419 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2420 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2421 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2422 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2423 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2424 <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
|
2425 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2426 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
|
2427 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2428 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2429 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
|
2430 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
|
2431 <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
|
2432 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2433 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2434 <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
|
2435 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2436 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
|
2437 For browsers compatibility, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2438 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
|
2439 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2440 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2441 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2442 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2443 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2444 <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
|
2445 <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
|
2446 <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
|
2447 <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
|
2448 <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
|
2449 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2450 Derives a secret key from a master key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2451 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2452 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2453 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2454 <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
|
2455 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2456 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
|
2457 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2458 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2459 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2460 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2461 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2462 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2463 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2464 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2465 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2466 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2467 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2468 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2469 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2470 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2471 <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
|
2472 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2473 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2474 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2475 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2476 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2477 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2478 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2479 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2480 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2481 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2482 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2483 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2484 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
|
2485 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
|
2486 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2487 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2488 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2489 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2490 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2491 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2492 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2493 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2494 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2495 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
|
2496 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2497 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2498 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
|
2499 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2500 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2501 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2502 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2503 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2504 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2505 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2506 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2507 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2508 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2509 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2510 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2511 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2512 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2513 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2514 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2515 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2516 <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
|
2517 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2518 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2519 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2520 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2521 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2522 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2523 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2524 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2525 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2526 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2527 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2528 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2529 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2530 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
|
2531 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2532 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2533 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2534 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2535 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2536 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
|
2537 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2538 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2539 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2540 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2541 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2542 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2543 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2544 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2545 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2546 <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
|
2547 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2548 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
|
2549 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2550 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2551 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
|
2552 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
|
2553 <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
|
2554 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2555 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2556 <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
|
2557 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2558 is an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2559 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
|
2560 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2561 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2562 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2563 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2564 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2565 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2566 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2567 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2568 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2569 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2570 should be set to <literal>HMAC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2571 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2572 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2573 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2574 <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
|
2575 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2576 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2577 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2578 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2579 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2580 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2581 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2582 <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
|
2583 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
|
2584 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
|
2585 the block size of the chozen hash function |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2586 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2587 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2588 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2589 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2590 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2591 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2592 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2593 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2594 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2595 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2596 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2597 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2598 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2599 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2600 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2601 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2602 should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2603 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2604 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2605 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2606 depending on the algorithm used |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2607 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2608 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2609 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2610 <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
|
2611 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
|
2612 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2613 <literal>192</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2614 <literal>256</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2615 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2616 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2617 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2618 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2619 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2620 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2621 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2622 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2623 <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
|
2624 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2625 is a boolean value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2626 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
|
2627 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2628 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2629 <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
|
2630 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2631 is an <literal>Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2632 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
|
2633 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
|
2634 set in <literal>derivedKeyAlgorithm</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2635 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2636 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2637 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2638 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2639 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2640 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2641 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2642 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2643 <tag-name><literal>decrypt</literal></tag-name> |
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 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2646 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2647 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2648 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2649 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2650 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2651 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2652 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2653 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2654 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2655 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2656 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2657 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2658 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2659 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2660 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2661 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2662 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2663 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2664 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2665 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2666 </tag-desc> |
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 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2669 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2670 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2671 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2672 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2673 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2674 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2675 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2676 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2677 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2678 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2679 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2680 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2681 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2682 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2683 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2684 <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
|
2685 <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
|
2686 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2687 Generates a digest of the given data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2688 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
|
2689 and the data to digest. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2690 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
|
2691 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2692 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2693 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2694 <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
|
2695 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2696 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
|
2697 <literal>SHA-1</literal> (not for cryptographic applications), |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2698 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2699 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2700 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2701 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2702 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2703 <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
|
2704 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2705 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2706 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2707 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2708 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2709 that contains the data to be digested |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2710 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2711 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2712 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2713 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2714 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2715 <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
|
2716 <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
|
2717 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2718 Exports a key: takes a key as |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2719 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
|
2720 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
|
2721 (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
|
2722 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
|
2723 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
|
2724 containing the key. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2725 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
|
2726 <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
|
2727 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2728 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2729 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2730 <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
|
2731 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2732 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
|
2733 can be the following: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2734 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2735 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2736 <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
|
2737 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2738 the raw data format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2739 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2740 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2741 <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
|
2742 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2743 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2744 <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
|
2745 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2746 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2747 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2748 <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
|
2749 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2750 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2751 <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
|
2752 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2753 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2754 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2755 <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
|
2756 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2757 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2758 <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
|
2759 (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
|
2760 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2761 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2762 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2763 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2764 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2765 <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
|
2766 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2767 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
|
2768 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
|
2769 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2770 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2771 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2772 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2773 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2774 <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
|
2775 <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
|
2776 <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
|
2777 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2778 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
|
2779 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
|
2780 (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
|
2781 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
|
2782 as |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
2783 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
|
2784 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
|
2785 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2786 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2787 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2788 <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
|
2789 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2790 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
|
2791 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
|
2792 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2793 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2794 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2795 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2796 <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
|
2797 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2798 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2799 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
|
2800 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2801 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2802 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2803 <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
|
2804 <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
|
2805 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2806 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2807 depending on the used algorithm |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2808 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2809 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2810 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2811 <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
|
2812 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
|
2813 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2814 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2815 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2816 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2817 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2818 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2819 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2820 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2821 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2822 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2823 <literal>ECDSA</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2824 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
|
2825 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2826 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2827 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2828 <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
|
2829 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2830 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2831 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2832 <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
|
2833 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
|
2834 <literal>P-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2835 <literal>P-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2836 <literal>P-521</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2837 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2838 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2839 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2840 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2841 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2842 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2843 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2844 <literal>HMAC</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2845 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
|
2846 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2847 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2848 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2849 <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
|
2850 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2851 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2852 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2853 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2854 <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
|
2855 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
|
2856 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2857 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2858 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2859 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2860 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2861 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2862 <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
|
2863 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
|
2864 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
|
2865 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
|
2866 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2867 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2868 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2869 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2870 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2871 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2872 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2873 <literal>AES-CTR</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2874 <literal>AES-CBC</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2875 <literal>AES-GCM</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2876 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
|
2877 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
|
2878 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
|
2879 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2880 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2881 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2882 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2883 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2884 <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
|
2885 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2886 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
|
2887 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2888 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2889 <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
|
2890 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2891 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
|
2892 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2893 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2894 <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
|
2895 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2896 key for encrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2897 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2898 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2899 <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
|
2900 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2901 key for decrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2902 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2903 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2904 <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
|
2905 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2906 key for signing messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2907 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2908 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2909 <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
|
2910 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2911 key for verifying signatures |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2912 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2913 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2914 <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
|
2915 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2916 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
|
2917 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2918 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2919 <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
|
2920 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2921 key for deriving bits |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2922 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2923 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2924 <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
|
2925 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2926 key for wrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2927 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2928 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2929 <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
|
2930 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2931 key for unwrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2932 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2933 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2934 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2935 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2936 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2937 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2938 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2939 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2940 <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
|
2941 <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
|
2942 <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
|
2943 <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
|
2944 <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
|
2945 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2946 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
|
2947 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
|
2948 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
|
2949 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
|
2950 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2951 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2952 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2953 <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
|
2954 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2955 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
|
2956 can be the following: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2957 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2958 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2959 <tag-name><literal>raw</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2960 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2961 the raw data format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2962 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2963 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2964 <tag-name><literal>pkcs8</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2965 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2966 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2967 <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
|
2968 format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2969 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2970 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2971 <tag-name><literal>spki</literal></tag-name> |
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 the |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2974 <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
|
2975 format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2976 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2977 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2978 <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
|
2979 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2980 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2981 <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
|
2982 (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
|
2983 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2984 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2985 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2986 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2987 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2988 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2989 <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
|
2990 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2991 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2992 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2993 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2994 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2995 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
|
2996 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2997 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2998 <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
|
2999 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3000 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
|
3001 and provides extra algorithm-specific parameters: |
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 type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3004 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3005 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3006 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3007 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3008 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3009 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3010 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3011 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3012 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3013 <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
|
3014 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3015 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3016 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3017 depending on the used algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3018 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3019 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3020 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3021 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3022 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
|
3023 <literal>SHA-1</literal>, |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3024 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3025 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3026 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3027 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3028 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3029 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3030 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3031 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3032 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3033 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3034 <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3035 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3036 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3037 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3038 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3039 <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
|
3040 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3041 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3042 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3043 <literal>namedCurve</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3044 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
|
3045 <literal>P-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3046 <literal>P-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3047 <literal>P-521</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3048 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3049 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3050 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3051 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3052 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3053 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3054 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3055 <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3056 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3057 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3058 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3059 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3060 <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
|
3061 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3062 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3063 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3064 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3065 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3066 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
|
3067 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3068 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3069 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3070 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3071 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3072 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3073 <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
|
3074 the length in bits of the key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3075 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
|
3076 generated by the chosen digest function. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3077 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3078 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3079 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3080 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3081 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3082 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3083 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3084 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3085 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3086 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3087 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
|
3088 of the form <literal>{ "name": "ALGORITHM" }</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3089 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
|
3090 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3091 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3092 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3093 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3094 <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3095 pass the <literal>PBKDF2</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3096 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3097 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3098 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3099 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3100 <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3101 pass the <literal>HKDF</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3102 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3103 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3104 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3105 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3106 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3107 <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
|
3108 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3109 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
|
3110 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3111 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3112 <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
|
3113 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3114 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
|
3115 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3116 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3117 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3118 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3119 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3120 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3121 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3122 <tag-name><literal>decrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3123 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3124 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3125 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3126 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3127 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3128 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3129 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3130 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3131 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3132 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3133 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3134 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3135 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3136 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3137 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3138 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3139 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3140 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3141 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3142 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3143 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3144 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3145 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3146 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3147 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3148 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3149 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3150 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3151 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3152 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3153 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3154 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3155 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3156 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3157 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3158 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3159 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3160 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3161 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3162 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3163 <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
|
3164 <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
|
3165 <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
|
3166 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3167 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
|
3168 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
|
3169 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3170 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3171 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3172 <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
|
3173 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3174 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
|
3175 and its parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3176 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3177 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3178 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3179 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3180 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3181 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
|
3182 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3183 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3184 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3185 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3186 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3187 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3188 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3189 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3190 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3191 <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
|
3192 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3193 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3194 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3195 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3196 <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
|
3197 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
|
3198 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3199 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3200 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3201 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3202 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3203 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3204 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3205 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3206 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3207 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3208 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3209 <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
|
3210 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3211 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3212 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3213 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3214 <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
|
3215 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3216 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3217 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3218 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3219 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3220 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3221 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3222 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3223 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3224 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3225 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3226 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
|
3227 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3228 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3229 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3230 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3231 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3232 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3233 <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
|
3234 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3235 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
|
3236 that the key to be used for signing. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
3237 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
|
3238 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3239 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3240 <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
|
3241 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3242 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3243 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3244 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3245 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3246 object that contains the data to be signed |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3247 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3248 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3249 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3250 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3251 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3252 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3253 <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
|
3254 <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
|
3255 <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
|
3256 <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
|
3257 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3258 Verifies a digital signature, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3259 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
|
3260 <literal>true</literal> if the signature is valid, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3261 otherwise <literal>false</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3262 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3263 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3264 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3265 <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
|
3266 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3267 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
|
3268 and its parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3269 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3270 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3271 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3272 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3273 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3274 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
|
3275 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3276 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3277 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3278 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3279 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3280 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3281 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3282 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3283 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3284 <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
|
3285 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3286 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3287 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3288 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3289 <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
|
3290 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
|
3291 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3292 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3293 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3294 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3295 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3296 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3297 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3298 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3299 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3300 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3301 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3302 <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
|
3303 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3304 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3305 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3306 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3307 <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
|
3308 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3309 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3310 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3311 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3312 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3313 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3314 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3315 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3316 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3317 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3318 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3319 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
|
3320 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3321 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3322 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3323 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3324 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3325 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3326 <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
|
3327 <tag-desc> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3328 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
|
3329 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
|
3330 It is the secret key for a symmetric algorithm |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
3331 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
|
3332 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3333 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3334 <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
|
3335 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3336 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3337 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3338 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3339 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3340 that contains the signature to verify |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3341 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3342 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3343 <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
|
3344 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3345 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3346 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3347 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3348 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3349 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
|
3350 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3351 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3352 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3353 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3354 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3355 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3356 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3357 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3358 </section> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3359 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3360 |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3361 <section id="cryptokey" name="CryptoKey"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3362 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3363 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3364 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3365 <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
|
3366 <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
|
3367 <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
|
3368 <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
|
3369 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3370 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3371 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3372 <para> |
2986
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3373 The <literal>CryptoKey</literal> object |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3374 represents a cryptographic <literal>key</literal> obtained |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3375 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
|
3376 <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
|
3377 <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
|
3378 <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
|
3379 </para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3380 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3381 <para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3382 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3383 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3384 <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
|
3385 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3386 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
|
3387 and any associated extra parameters |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3388 (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
|
3389 read-only |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3390 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3391 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3392 <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
|
3393 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3394 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
|
3395 (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
|
3396 read-only |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3397 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3398 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3399 <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
|
3400 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3401 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
|
3402 read-only. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3403 Possible values: |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3404 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3405 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3406 <tag-name><literal>secret</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3407 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3408 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
|
3409 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3410 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3411 <tag-name><literal>private</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3412 <tag-desc> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3413 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
|
3414 <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
|
3415 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3416 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3417 <tag-name><literal>public</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3418 <tag-desc> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3419 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
|
3420 <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
|
3421 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3422 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3423 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3424 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3425 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3426 <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
|
3427 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3428 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
|
3429 (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
|
3430 read-only. |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3431 Possible array values: |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3432 <list type="tag"> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3433 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3434 <tag-name><literal>encrypt</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3435 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3436 key for encrypting messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3437 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3438 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3439 <tag-name><literal>decrypt</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3440 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3441 key for decrypting messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3442 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3443 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3444 <tag-name><literal>sign</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3445 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3446 key for signing messages |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3447 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3448 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3449 <tag-name><literal>verify</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3450 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3451 key for verifying signatures |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3452 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3453 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3454 <tag-name><literal>deriveKey</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3455 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3456 key for deriving a new key |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3457 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3458 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3459 <tag-name><literal>deriveBits</literal></tag-name> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3460 <tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3461 key for deriving bits |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3462 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3463 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3464 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3465 </tag-desc> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3466 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3467 </list> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3468 </para> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3469 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3470 </section> |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3471 |
2b161541806a
Documented the CryptoKey object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2983
diff
changeset
|
3472 |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3473 <section id="cryptokeypair" name="CryptoKeyPair"> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3474 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3475 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3476 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3477 <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
|
3478 <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
|
3479 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3480 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3481 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3482 <para> |
2987
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3483 The <literal>CryptoKeyPair</literal> is a dictionary object |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3484 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
|
3485 that represents an asymmetric key pair. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3486 </para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3487 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3488 <para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3489 <list type="tag"> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3490 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3491 <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
|
3492 <tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3493 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
|
3494 representing the private key. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3495 </tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3496 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3497 <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
|
3498 <tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3499 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
|
3500 representing the public key. |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3501 </tag-desc> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3502 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3503 </list> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3504 </para> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3505 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3506 </section> |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3507 |
b70e9b806810
Documented CryptoKeyPair object in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2986
diff
changeset
|
3508 |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3509 <section id="njs" name="njs"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3510 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3511 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3512 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3513 <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
|
3514 <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
|
3515 <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
|
3516 <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
|
3517 <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
|
3518 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3519 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3520 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3521 <para> |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3522 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
|
3523 that represents the current VM instance |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3524 (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
|
3525 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3526 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3527 <para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3528 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3529 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3530 <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
|
3531 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3532 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
|
3533 (for example, “0.7.4”). |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3534 </tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3535 |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3536 <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
|
3537 <tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
3538 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
|
3539 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
|
3540 (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
|
3541 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3542 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3543 <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
|
3544 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3545 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
|
3546 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3547 |
2904
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3548 <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
|
3549 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3550 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
|
3551 (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
|
3552 <list type="tag"> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3553 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3554 <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
|
3555 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3556 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
|
3557 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3558 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3559 </list> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3560 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
3561 |
2679
8f3e9ff2785f
Corrected syntax of njs.on() and ngx.fetch() in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2670
diff
changeset
|
3562 <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
|
3563 <value>callback</value>)</literal></tag-name> |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3564 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3565 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
|
3566 (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
|
3567 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
|
3568 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3569 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3570 <tag-name><literal>exit</literal></tag-name> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3571 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3572 is called before the VM is destroyed. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3573 The callback is called without arguments. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3574 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3575 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3576 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3577 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3578 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3579 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3580 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3581 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3582 </section> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3583 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
3584 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3585 <section id="process" name="process"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3586 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3587 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3588 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3589 <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
|
3590 <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
|
3591 <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
|
3592 <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
|
3593 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3594 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3595 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3596 <para> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3597 The <literal>process</literal> object is a global object |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3598 that provides information about the current process |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3599 (<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
|
3600 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3601 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3602 <para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3603 <list type="tag"> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3604 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3605 <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
|
3606 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3607 Returns an array that contains the command line arguments |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3608 passed when the current process was launched. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3609 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3610 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3611 <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
|
3612 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3613 Returns an object containing the user environment. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3614 <note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3615 By default, nginx removes all environment variables inherited |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3616 from its parent process except the TZ variable. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3617 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
|
3618 to preserve some of the inherited variables. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3619 </note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3620 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3621 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3622 <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
|
3623 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3624 Returns the PID of the current process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3625 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3626 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3627 <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
|
3628 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3629 Returns the PID of the current parent process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3630 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3631 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3632 </list> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3633 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3634 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3635 </section> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3636 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
3637 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3638 <section id="string" name="String"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3639 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3640 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3641 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
|
3642 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
|
3643 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
|
3644 byte strings were also supported. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3645 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3646 |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3647 <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
|
3648 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3649 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3650 <note> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3651 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
|
3652 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
|
3653 When working with byte sequence, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3654 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
|
3655 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
|
3656 <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
|
3657 <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
|
3658 should be used. |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3659 </note> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3660 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3661 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3662 <para> |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
3663 Byte strings contain a sequence of bytes |
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
3664 and are used to serialize Unicode strings |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3665 to external data and deserialize from external sources. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3666 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
|
3667 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
|
3668 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3669 >> '£'.toUTF8().toString('hex') |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
3670 '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
|
3671 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3672 The <link id="string_tobytes">toBytes()</link> method serializes |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3673 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
|
3674 otherwise, <literal>null</literal> is returned: |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3675 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3676 >> '£'.toBytes().toString('hex') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
3677 '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
|
3678 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3679 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3680 <list type="tag"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3681 |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3682 <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
|
3683 | <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
|
3684 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3685 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
|
3686 <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
|
3687 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
|
3688 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
|
3689 <example> |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
3690 >> 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
|
3691 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3692 |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
3693 >> Buffer.from('YnVmZmVy', 'base64').toString() |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3694 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3695 </example> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3696 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
|
3697 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
|
3698 or from an encoded string |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3699 (<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
|
3700 the encoding could be |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3701 <literal>hex</literal>, |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3702 <literal>base64</literal>, and |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3703 <literal>base64url</literal>. |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3704 </tag-desc> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
3705 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3706 <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
|
3707 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3708 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3709 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
|
3710 <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
|
3711 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
|
3712 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
|
3713 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
|
3714 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
|
3715 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3716 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3717 <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
|
3718 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3719 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3720 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
|
3721 <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
|
3722 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
|
3723 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
|
3724 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3725 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
|
3726 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
|
3727 into a Unicode string, |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3728 otherwise <literal>null</literal> was returned. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3729 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3730 |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3731 <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
|
3732 <value>end</value>])</literal></tag-name> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3733 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3734 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
|
3735 <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
|
3736 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
|
3737 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
|
3738 serialized a Unicode string to a byte string, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3739 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
|
3740 found in the string. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3741 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3742 |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3743 <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
|
3744 <tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3745 <para> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3746 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
|
3747 <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
|
3748 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
|
3749 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
|
3750 encoded a string to |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3751 <literal>hex</literal>, |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3752 <literal>base64</literal>, or |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3753 <literal>base64url</literal>: |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3754 <example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3755 >> 'αβγδ'.toString('base64url') |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3756 'zrHOss6zzrQ' |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3757 </example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3758 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
|
3759 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
|
3760 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3761 >> 'αβγδ'.toUTF8().toString('base64url') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
3762 'zrHOss6zzrQ' |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3763 </example> |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
3764 </para> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3765 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3766 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3767 <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
|
3768 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3769 <tag-desc> |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3770 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
|
3771 <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
|
3772 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
|
3773 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
|
3774 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3775 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
|
3776 serialized a Unicode string |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
3777 to a byte string using UTF-8 encoding: |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3778 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3779 >> 'αβγδ'.toUTF8().length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3780 8 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3781 >> 'αβγδ'.length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3782 4 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3783 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3784 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3785 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3786 </list> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3787 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3788 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3789 </section> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3790 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3791 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3792 |
2982
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3793 </section> |
02889d1bab78
Marked byte string methods as removed in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2981
diff
changeset
|
3794 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3795 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3796 <section id="webapi" name="web API"> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3797 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
3798 |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3799 <section id="textdecoder" name="Text Decoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3800 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3801 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3802 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3803 <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
|
3804 <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
|
3805 <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
|
3806 <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
|
3807 <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
|
3808 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3809 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3810 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3811 <para> |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3812 The <literal>TextDecoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3813 produces a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3814 from a stream of bytes |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3815 (<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
|
3816 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3817 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3818 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3819 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3820 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3821 <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
|
3822 <value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3823 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3824 Creates a new <literal>TextDecoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3825 for specified <literal>encoding</literal>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3826 currently, only UTF-8 is supported. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3827 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3828 <literal>TextDecoderOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3829 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3830 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3831 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3832 <tag-name><literal>fatal</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3833 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3834 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3835 <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
|
3836 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
|
3837 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
|
3838 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3839 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3840 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3841 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3842 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3843 <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
|
3844 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3845 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
|
3846 <link id="textdecoder"><literal>TextDecoder()</literal></link>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3847 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3848 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3849 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3850 <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
|
3851 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3852 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3853 the error mode is fatal, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3854 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3855 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3856 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3857 <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
|
3858 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3859 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3860 the byte order marker is ignored, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3861 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3862 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3863 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3864 <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
|
3865 [<value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3866 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3867 Returns a string with the text |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3868 decoded from the <literal>buffer</literal> by |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3869 <link id="textdecoder"><literal>TextDecoder()</literal></link>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3870 The buffer can be <literal>ArrayBuffer</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3871 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3872 <literal>TextDecodeOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3873 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3874 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3875 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3876 <tag-name><literal>stream</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3877 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3878 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3879 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
|
3880 <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
|
3881 <literal>false</literal> for the final chunk |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3882 or if the data is not chunked. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3883 By default is <literal>false</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3884 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3885 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3886 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3887 <example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3888 >> (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
|
3889 αβ |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3890 </example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3891 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3892 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3893 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3894 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3895 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3896 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3897 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3898 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3899 <section id="textencoder" name="Text Encoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3900 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3901 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3902 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3903 <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
|
3904 <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
|
3905 <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
|
3906 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3907 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3908 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3909 <para> |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3910 The <literal>TextEncoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3911 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
|
3912 from a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3913 (<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
|
3914 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3915 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3916 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3917 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3918 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3919 <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
|
3920 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3921 Returns a newly constructed <literal>TextEncoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3922 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
|
3923 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3924 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3925 <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
|
3926 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3927 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
|
3928 with UTF-8 encoded text. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3929 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3930 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3931 <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
|
3932 <value>uint8Array</value>)</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3933 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3934 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
|
3935 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
|
3936 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
|
3937 The dictionary object contains two members: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3938 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3939 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3940 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3941 <tag-name><literal>read</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3942 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3943 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
|
3944 converted to UTF-8 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3945 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3946 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3947 <tag-name><literal>written</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3948 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3949 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
|
3950 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3951 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3952 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3953 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3954 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3955 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3956 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3957 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3958 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3959 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3960 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3961 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3962 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3963 <section id="njs_api_timers" name="timers"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3964 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3965 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3966 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3967 <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
|
3968 <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
|
3969 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3970 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3971 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
3972 <para> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3973 <list type="tag"> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3974 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3975 <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
|
3976 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3977 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
|
3978 created by <link id="settimeout"><literal>setTimeout()</literal></link>. |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3979 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3980 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3981 <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
|
3982 <value>milliseconds</value>[, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3983 <value>argument1</value>, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3984 <value>argumentN</value>])</literal></tag-name> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3985 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3986 Calls a <literal>function</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3987 after a specified number of <literal>milliseconds</literal>. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3988 One or more optional <literal>arguments</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3989 can be passed to the specified function. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3990 Returns a <literal>timeout</literal> object. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3991 <example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3992 function handler(v) |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3993 { |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3994 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3995 } |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3996 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3997 t = setTimeout(handler, 12); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3998 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3999 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4000 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4001 clearTimeout(t); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4002 </example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4003 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4004 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4005 </list> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4006 </para> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4007 |
2873
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4008 <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
|
4009 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4010 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4011 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4012 <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
|
4013 <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
|
4014 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4015 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4016 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4017 <para> |
2873
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4018 <list type="tag"> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4019 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4020 <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
|
4021 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4022 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
|
4023 using <literal>Base64</literal> encoding. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4024 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
|
4025 that contains Base64-encoded data. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4026 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
|
4027 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4028 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
|
4029 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
|
4030 which may otherwise cause communication problems, |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4031 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
|
4032 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4033 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
|
4034 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
|
4035 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4036 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
|
4037 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
|
4038 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4039 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4040 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4041 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4042 <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
|
4043 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4044 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
|
4045 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
|
4046 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
|
4047 <literal>stringToEncode</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4048 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4049 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
|
4050 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
|
4051 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
|
4052 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4053 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
|
4054 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
|
4055 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4056 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
|
4057 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
|
4058 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4059 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4060 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4061 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4062 </list> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4063 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4064 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4065 </section> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
4066 |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4067 </section> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4068 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
4069 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
4070 <section id="builtin_modules" name="built-in modules"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4071 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
4072 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4073 <section id="buffer" name="Buffer"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4074 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4075 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4076 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4077 <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
|
4078 <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
|
4079 <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
|
4080 <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
|
4081 <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
|
4082 <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
|
4083 <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
|
4084 <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
|
4085 <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
|
4086 <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
|
4087 <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
|
4088 <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
|
4089 <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
|
4090 <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
|
4091 <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
|
4092 <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
|
4093 <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
|
4094 <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
|
4095 <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
|
4096 <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
|
4097 <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
|
4098 <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
|
4099 <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
|
4100 <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
|
4101 <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
|
4102 <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
|
4103 <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
|
4104 <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
|
4105 <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
|
4106 <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
|
4107 <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
|
4108 <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
|
4109 <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
|
4110 <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
|
4111 <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
|
4112 <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
|
4113 <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
|
4114 <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
|
4115 <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
|
4116 <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
|
4117 <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
|
4118 <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
|
4119 <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
|
4120 <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
|
4121 <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
|
4122 <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
|
4123 <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
|
4124 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4125 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4126 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4127 <para> |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4128 <list type="tag"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4129 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4130 <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
|
4131 <value>fill</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4132 <value>encoding</value>]]))</literal></tag-name> |
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 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4135 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
|
4136 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
|
4137 If <value>fill</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4138 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4139 <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
|
4140 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
|
4141 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4142 <link id="buf_fill"><literal>buf.fill(fill, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4143 encoding)</literal></link>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4144 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4145 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4146 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4147 The <value>fill</value> parameter may be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4148 <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4149 <value>Buffer</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4150 <value>Uint8Array</value>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4151 <value>integer</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4152 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4153 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4154 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4155 <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
|
4156 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4157 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4158 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4159 <link id="buffer_alloc"><literal>Buffer.alloc()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4160 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
|
4161 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
|
4162 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4163 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4164 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4165 <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
|
4166 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4167 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4168 Returns the byte length of a specified value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4169 when encoded using <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4170 The value can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4171 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4172 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4173 <literal>TypedArray</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4174 <literal>DataView</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4175 <literal>ArrayBuffer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4176 If the value is a <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4177 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
|
4178 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4179 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4180 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4181 <value>base64url</value>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4182 by default is <value>utf8</value>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4183 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4184 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4185 <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
|
4186 <value>buffer2</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4187 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4188 Compares <value>buffer1</value> with <value>buffer2</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4189 when sorting arrays of Buffer instances. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4190 Returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4191 <literal>0</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4192 <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
|
4193 <literal>1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4194 <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
|
4195 <literal>-1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4196 <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
|
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="buffer_concat"><literal>Buffer.concat(<value>list</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4200 <value>totalLength</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4201 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4202 Returns a new Buffer |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4203 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
|
4204 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
|
4205 a new zero-length Buffer is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4206 If <value>totalLength</value> is not specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4207 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
|
4208 If <value>totalLength</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4209 it is coerced to an unsigned integer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4210 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
|
4211 <value>totalLength</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4212 the result is truncated to <value>totalLength</value>. |
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="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
|
4216 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4217 Allocates a new Buffer using an array of bytes |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4218 in the range <literal>0</literal> – <literal>255</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4219 Array entries outside that range will be truncated. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4220 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4221 |
2612
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4222 <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
|
4223 <value>byteOffset</value>[, |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4224 <value>length</value>]])</literal></tag-name> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4225 <tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4226 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
|
4227 without copying the underlying memory. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4228 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
|
4229 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
|
4230 that will be shared by the Buffer. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4231 </tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
4232 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4233 <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
|
4234 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4235 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
|
4236 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4237 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4238 <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
|
4239 <value>offsetOrEncoding</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4240 <value>length</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4241 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4242 For objects whose <literal>valueOf()</literal> function |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4243 returns a value not strictly equal to object, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4244 returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4245 <literal>Buffer.from(object.valueOf()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4246 <literal>offsetOrEncoding</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4247 <literal>length</literal>). |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4248 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4249 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4250 <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
|
4251 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4252 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4253 Creates a new Buffer with a <value>string</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4254 The <value>encoding</value> parameter identifies the character encoding |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4255 to be used when converting a string into bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4256 The encoding can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4257 <literal>utf8</literal>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4258 <literal>hex</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4259 <literal>base64</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4260 <literal>base64url</literal>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4261 by default is <literal>utf8</literal>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4262 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4263 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4264 <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
|
4265 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4266 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4267 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
|
4268 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4269 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4270 <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
|
4271 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4272 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4273 returns <literal>true</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4274 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
|
4275 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4276 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4277 <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
|
4278 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4279 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
|
4280 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
|
4281 The values refer to individual bytes, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4282 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
|
4283 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4284 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4285 <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
|
4286 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4287 The underlying <literal>ArrayBuffer</literal> object |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4288 based on which this Buffer object is created. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4289 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4290 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4291 <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
|
4292 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4293 An integer, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4294 specifying the <literal>byteOffset</literal> of the Buffers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4295 underlying <literal>ArrayBuffer</literal> object. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4296 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4297 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4298 <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
|
4299 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4300 <value>targetEnd</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4301 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4302 <value>sourceEnd</value>]]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4303 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4304 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
|
4305 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
|
4306 as <value>target</value> in sort order. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4307 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
|
4308 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4309 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
|
4310 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4311 The <literal>targetEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4312 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
|
4313 by default is <literal>target.length</literal>. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4314 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4315 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
|
4316 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4317 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4318 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
|
4319 by default is <literal>buf.length</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4320 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4321 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4322 <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
|
4323 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4324 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4325 <value>sourceEnd</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4326 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4327 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
|
4328 even if the target memory region overlaps with buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4329 The <literal>target</literal> parameter is a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4330 <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
|
4331 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4332 <para> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4333 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4334 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
|
4335 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4336 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4337 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
|
4338 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4339 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4340 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
|
4341 by default is <value>buf.length</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4342 </para> |
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 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4345 <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
|
4346 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4347 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4348 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
|
4349 have exactly the same bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4350 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4351 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4352 <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
|
4353 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4354 <value>end</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4355 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4356 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4357 Fills the Buffer with the specified <value>value</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4358 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
|
4359 the entire Buffer will be filled. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4360 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
|
4361 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4362 <literal>Buffer</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4363 <literal>integer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4364 If the resulting integer is greater than 255, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4365 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
|
4366 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4367 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4368 <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
|
4369 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4370 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4371 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4372 Equivalent to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4373 <link id="buf_indexof"><literal>buf.indexOf()</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4374 <literal>!== -1</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4375 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
|
4376 in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4377 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4378 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4379 <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
|
4380 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4381 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4382 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4383 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
|
4384 <value>value</value> in Buffer, or <value>-1</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4385 if Buffer does not contain value. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4386 The <value>value</value> can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4387 <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
|
4388 (by default <value>utf8</value>), |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4389 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4390 <literal>Unit8Array</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4391 or a number between 0 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4392 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4393 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4394 <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
|
4395 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4396 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4397 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4398 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4399 <link id="buf_indexof"><literal>buf.indexOf()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4400 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
|
4401 instead of the first occurrence. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4402 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
|
4403 integer between 1 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4404 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
|
4405 <literal>byteOffset</literal> will be returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4406 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4407 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4408 <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
|
4409 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4410 Returns the number of bytes in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4411 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4412 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4413 <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
|
4414 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4415 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4416 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4417 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4418 and interprets the result as a big-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4419 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
|
4420 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
|
4421 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4422 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4423 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4424 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4425 <literal>buf.readInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4426 <literal>buf.readInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4427 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4428 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4429 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4430 <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
|
4431 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4432 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4433 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4434 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4435 and interprets the result as a little-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4436 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
|
4437 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
|
4438 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4439 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4440 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4441 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4442 <literal>buf.readInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4443 <literal>buf.readInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4444 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4445 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4446 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4447 <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
|
4448 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4449 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4450 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4451 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4452 and interprets the result as a big-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4453 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4454 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
|
4455 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4456 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4457 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4458 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4459 <literal>buf.readUInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4460 <literal>buf.readUInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4461 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4462 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4463 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4464 <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
|
4465 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4466 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4467 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4468 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4469 and interprets the result as a little-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4470 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4471 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
|
4472 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4473 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4474 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4475 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4476 <literal>buf.readUInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4477 <literal>buf.readUInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4478 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4479 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4480 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4481 <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
|
4482 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4483 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
|
4484 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4485 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4486 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4487 <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
|
4488 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4489 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
|
4490 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4491 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4492 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4493 <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
|
4494 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4495 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
|
4496 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4497 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4498 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4499 <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
|
4500 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4501 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
|
4502 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4503 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4504 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4505 <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
|
4506 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4507 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4508 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4509 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4510 but offset and cropped by |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4511 <value>start</value> and <value>end</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4512 If <value>end</value> is greater than |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4513 <link id="buf_length"><literal>buf.length</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4514 the same result as that of end equal to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4515 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4516 is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4517 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4518 |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4519 <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
|
4520 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4521 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4522 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4523 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4524 but offset and cropped by the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4525 <value>start</value> and <value>end</value> values. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4526 The method is not compatible with the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4527 <literal>Uint8Array.prototype.slice()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4528 which is a superclass of Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4529 To copy the slice, use |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4530 <literal>Uint8Array.prototype.slice()</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4531 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4532 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4533 <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
|
4534 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4535 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
|
4536 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4537 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4538 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4539 is not a multiple of 2. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4540 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4541 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4542 <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
|
4543 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4544 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
|
4545 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4546 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4547 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4548 is not a multiple of 4. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4549 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4550 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4551 <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
|
4552 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4553 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
|
4554 and swaps byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4555 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4556 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4557 is not a multiple of 8. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4558 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4559 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4560 <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
|
4561 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4562 Returns a JSON representation of <literal>buf.</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4563 <literal>JSON.stringify()</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4564 implicitly calls this function when stringifying a Buffer instance. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4565 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4566 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4567 <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
|
4568 <value>start</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4569 <value>end</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4570 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4571 Decodes <literal>buf</literal> to a string |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
4572 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
|
4573 which can be <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4574 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4575 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4576 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4577 The <value>start</value> and <value>end</value> parameters |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4578 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
|
4579 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4580 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4581 <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
|
4582 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4583 <value>length</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4584 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4585 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4586 Writes a <value>string</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4587 at <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4588 according to the character <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4589 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
|
4590 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
|
4591 only part of string will be written, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4592 however, partially encoded characters will not be written. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4593 The <value>encoding</value> can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
4594 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4595 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4596 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4597 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4598 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4599 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4600 <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
|
4601 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4602 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4603 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4604 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4605 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4606 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4607 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4608 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
|
4609 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4610 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4611 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4612 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4613 <literal>buf.writeInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4614 <literal>buf.writeInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4615 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4616 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4617 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4618 <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
|
4619 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4620 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4621 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4622 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4623 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4624 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4625 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4626 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
|
4627 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4628 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4629 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4630 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4631 <literal>buf.writeInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4632 <literal>buf.writeInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4633 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4634 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4635 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4636 <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
|
4637 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4638 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4639 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4640 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4641 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4642 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4643 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4644 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
|
4645 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4646 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4647 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4648 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4649 <literal>buf.writeUInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4650 <literal>buf.writeUInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4651 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4652 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4653 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4654 <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
|
4655 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4656 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4657 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4658 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4659 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4660 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4661 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4662 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
|
4663 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4664 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4665 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4666 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4667 <literal>buf.writeUInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4668 <literal>buf.writeUInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4669 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4670 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4671 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4672 <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
|
4673 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4674 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4675 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4676 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4677 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4678 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4679 <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
|
4680 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4681 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4682 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4683 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4684 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4685 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4686 <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
|
4687 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4688 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4689 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4690 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4691 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4692 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4693 <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
|
4694 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4695 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4696 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4697 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4698 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4699 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4700 </list> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4701 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4702 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4703 </section> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4704 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
4705 |
2177 | 4706 <section id="crypto" name="Crypto"> |
4707 | |
4708 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4709 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4710 <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
|
4711 <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
|
4712 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4713 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4714 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4715 <para> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4716 <note> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4717 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
|
4718 extended crypto API is available as a global |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4719 <link id="builtin_crypto">crypto</link> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
4720 </note> |
2177 | 4721 The Crypto module provides cryptographic functionality support. |
4722 The Crypto module object is returned by <literal>require('crypto')</literal>. | |
4723 </para> | |
4724 | |
4725 <para> | |
4726 <list type="tag"> | |
4727 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
4728 <tag-name id="crypto_createhash"><literal>crypto.createHash(<value>algorithm</value>)</literal></tag-name> |
2177 | 4729 <tag-desc> |
4730 Creates and returns a <link id="crypto_hash">Hash</link> object | |
4731 that can be used to generate hash digests | |
4732 using the given <value>algorithm</value>. | |
2496
9dddac1420fe
Fixed typo in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2484
diff
changeset
|
4733 The algorithm can be |
2177 | 4734 <literal>md5</literal>, |
4735 <literal>sha1</literal>, and | |
4736 <literal>sha256</literal>. | |
4737 </tag-desc> | |
4738 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
4739 <tag-name id="crypto_createhmac"><literal>crypto.createHmac(<value>algorithm</value>, |
2177 | 4740 <value>secret key</value>)</literal></tag-name> |
4741 <tag-desc> | |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
4742 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
|
4743 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
|
4744 The algorithm can be |
2177 | 4745 <literal>md5</literal>, |
4746 <literal>sha1</literal>, and | |
4747 <literal>sha256</literal>. | |
4748 </tag-desc> | |
4749 | |
4750 </list> | |
4751 </para> | |
4752 | |
4753 | |
4754 <section id="crypto_hash" name="Hash"> | |
4755 | |
4756 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4757 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4758 <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
|
4759 <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
|
4760 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4761 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4762 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4763 <para> |
2177 | 4764 <list type="tag"> |
4765 | |
2601 | 4766 <tag-name id="crypto_hash_update"><literal>hash.update(<value>data</value>)</literal></tag-name> |
2177 | 4767 <tag-desc> |
4768 Updates the hash content with the given <value>data</value>. | |
4769 </tag-desc> | |
4770 | |
2601 | 4771 <tag-name id="crypto_hash_digest"><literal>hash.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 4772 <tag-desc> |
4773 Calculates the digest of all of the data passed using | |
4774 <literal>hash.update()</literal>. | |
4775 The encoding can be | |
4776 <literal>hex</literal>, | |
4777 <literal>base64</literal>, and | |
4778 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4779 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
|
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 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
|
4784 </note> |
2177 | 4785 </tag-desc> |
4786 | |
2952
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4787 <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
|
4788 <tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4789 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
|
4790 (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
|
4791 </tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
4792 |
2177 | 4793 </list> |
4794 </para> | |
4795 | |
4796 <para> | |
4797 <example> | |
4798 >> var cr = require('crypto') | |
4799 undefined | |
4800 | |
4801 >> 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
|
4802 'BtlFlCqiamG-GMPiK_GbvKjdK10' |
2177 | 4803 </example> |
4804 </para> | |
4805 | |
4806 </section> | |
4807 | |
4808 | |
4809 <section id="crypto_hmac" name="HMAC"> | |
4810 | |
4811 <para> | |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4812 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4813 <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
|
4814 <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
|
4815 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4816 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4817 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4818 <para> |
2177 | 4819 <list type="tag"> |
4820 | |
2601 | 4821 <tag-name id="crypto_hmac_update"><literal>hmac.update(<value>data</value>)</literal></tag-name> |
2177 | 4822 <tag-desc> |
4823 Updates the HMAC content with the given <value>data</value>. | |
4824 </tag-desc> | |
4825 | |
2601 | 4826 <tag-name id="crypto_hmac_digest"><literal>hmac.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 4827 <tag-desc> |
4828 Calculates the HMAC digest of all of the data passed using | |
4829 <literal>hmac.update()</literal>. | |
4830 The encoding can be | |
4831 <literal>hex</literal>, | |
4832 <literal>base64</literal>, and | |
4833 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4834 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
|
4835 (<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
|
4836 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4837 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
|
4838 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
|
4839 </note> |
2177 | 4840 </tag-desc> |
4841 </list> | |
4842 </para> | |
4843 | |
4844 <para> | |
4845 <example> | |
4846 >> var cr = require('crypto') | |
4847 undefined | |
4848 | |
4849 >> 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
|
4850 'Oglm93xn23_MkiaEq_e9u8zk374' |
2177 | 4851 </example> |
4852 </para> | |
4853 | |
4854 </section> | |
4855 | |
4856 </section> | |
4857 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4858 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4859 <section id="njs_api_fs" name="File System"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4860 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4861 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4862 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4863 <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
|
4864 <tr><td><link id="fs_appendfilesync"><literal>fs.appendFileSync()</literal></link></td></tr> |
3021
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4865 <tr><td><link id="fs_closesync"><literal>fs.closeSync()</literal></link></td></tr> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4866 <tr><td><link id="fs_existssync"><literal>fs.existsSync()</literal></link></td></tr> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4867 <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
|
4868 <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
|
4869 <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
|
4870 <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
|
4871 <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
|
4872 <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
|
4873 <tr><td><link id="fs_readfilesync"><literal>fs.readFileSync()</literal></link></td></tr> |
3020
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4874 <tr><td><link id="fs_readsync"><literal>fs.readSync()</literal></link></td></tr> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4875 <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
|
4876 <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
|
4877 <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
|
4878 <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
|
4879 <tr><td><link id="fs_symlinksync"><literal>fs.symlinkSync()</literal></link></td></tr> |
3020
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4880 <tr><td><link id="fs_unlinksync"><literal>fs.unlinkSync()</literal></link></td></tr> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4881 <tr><td><link id="fs_writefilesync"><literal>fs.writeFileSync()</literal></link></td></tr> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4882 <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
|
4883 <tr><td><link id="fs_writesync_str"><literal>fs.writeSync()</literal></link></td></tr> |
3020
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4884 </table> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4885 </para> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4886 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4887 <para> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4888 <table width="100%"> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4889 <tr><td><link id="fs_dirent"><literal>fs.Dirent</literal></link></td></tr> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4890 <tr><td><link id="fs_filehandle"><literal>fs.FileHandle</literal></link></td></tr> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4891 <tr><td><link id="fs_stats"><literal>fs.Stats</literal></link></td></tr> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4892 <tr><td><link id="access_const"><literal>File Access Constants</literal></link></td></tr> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
4893 <tr><td><link id="njs_api_fs_flags"><literal>File System Flags</literal></link></td></tr> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4894 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4895 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4896 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
4897 <para> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4898 The File System module provides operations with files. |
2507 | 4899 </para> |
4900 | |
4901 <para> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4902 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
|
4903 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
|
4904 promissified versions of file system methods are available through |
2507 | 4905 <literal>require('fs').promises</literal> object: |
4906 <example> | |
4907 > var fs = require('fs').promises; | |
4908 undefined | |
4909 > fs.readFile("/file/path").then((data)=>console.log(data)) | |
4910 <file data> | |
4911 </example> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4912 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4913 |
2507 | 4914 <tag-name id="fs_accesssync"><literal>accessSync(<value>path</value>[, |
4915 <value>mode</value>])</literal></tag-name> | |
4916 <tag-desc> | |
4917 Synchronously tests permissions for a file or directory | |
4918 specified in the <literal>path</literal> | |
4919 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
4920 If the check fails, an error will be returned, | |
4921 otherwise, the method will return undefined. | |
4922 <list type="tag"> | |
4923 | |
4924 <tag-name><literal>mode</literal></tag-name> | |
4925 <tag-desc> | |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4926 an optional integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4927 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
|
4928 by default is <link id="access_const"><literal>fs.constants.F_OK</literal></link> |
2507 | 4929 <example> |
4930 try { | |
4931 fs.accessSync('/file/path', fs.constants.R_OK | fs.constants.W_OK); | |
4932 console.log('has access'); | |
4933 } catch (e) { | |
4934 console.log('no access');) | |
4935 } | |
4936 </example> | |
4937 </tag-desc> | |
4938 | |
4939 </list> | |
4940 </tag-desc> | |
4941 | |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4942 <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
|
4943 <value>data</value>[, <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4944 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4945 Synchronously appends specified <literal>data</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4946 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
|
4947 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
|
4948 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
|
4949 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
|
4950 The <literal>options</literal> parameter is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4951 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4952 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4953 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4954 <tag-name><literal>mode</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4955 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4956 mode option, by default is <literal>0o666</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4957 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4958 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4959 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4960 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4961 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
|
4962 by default is <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4963 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4964 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4965 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4966 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4967 |
3021
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4968 <tag-name id="fs_closesync"><literal>closeSync(<value>fd</value>)</literal></tag-name> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4969 <tag-desc> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4970 Closes the <literal>fd</literal> file descriptor represented by an integer |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4971 used by the method. |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4972 Returns <literal>undefined</literal>. |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4973 </tag-desc> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4974 |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4975 <tag-name id="fs_existssync"><literal>existsSync(<value>path</value>)</literal></tag-name> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4976 <tag-desc> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4977 Boolean value, returns |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4978 <literal>true</literal> if the specified <value>path</value> exists. |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4979 (<link doc="changes.xml" id="njs0.8.2">0.8.2</link>) |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4980 </tag-desc> |
ec6f7fcd3d90
Added fs.existsSync and fs.closeSync to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3020
diff
changeset
|
4981 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4982 <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
|
4983 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4984 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
|
4985 for the file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4986 (<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
|
4987 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
|
4988 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
|
4989 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4990 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4991 <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
|
4992 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4993 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4994 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4995 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
|
4996 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
|
4997 (<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
|
4998 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
|
4999 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5000 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5001 <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
|
5002 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5003 a boolean value which indicates |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5004 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
|
5005 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5006 by default is <literal>false</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5007 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5008 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5009 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5010 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5011 <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
|
5012 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5013 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5014 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
|
5015 (<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
|
5016 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
|
5017 <literal>integer</literal> that specifies |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5018 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
|
5019 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
|
5020 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5021 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5022 <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
|
5023 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5024 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
|
5025 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5026 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5027 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5028 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5029 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5030 <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
|
5031 <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
|
5032 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5033 Returns an integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5034 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
|
5035 (<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
|
5036 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5037 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5038 <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
|
5039 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5040 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
|
5041 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
|
5042 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5043 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5044 <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
|
5045 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5046 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
|
5047 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5048 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5049 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5050 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5051 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5052 <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
|
5053 <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
|
5054 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5055 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
|
5056 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
|
5057 (<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
|
5058 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5059 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5060 <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
|
5061 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5062 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
|
5063 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
|
5064 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5065 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5066 <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
|
5067 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5068 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
|
5069 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5070 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5071 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5072 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5073 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5074 <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
|
5075 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5076 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5077 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
|
5078 at the specified <literal>path</literal> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5079 (<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
|
5080 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
|
5081 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
|
5082 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
|
5083 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5084 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5085 <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
|
5086 <tag-desc> |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5087 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
|
5088 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
|
5089 (<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
|
5090 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5091 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5092 <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
|
5093 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5094 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
|
5095 <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
|
5096 by default is <literal>false</literal>. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5097 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5098 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5099 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5100 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5101 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
5102 <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
|
5103 <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5104 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5105 Synchronously returns the contents of the file |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5106 with provided <literal>filename</literal>. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5107 The <literal>options</literal> parameter holds |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5108 <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
|
5109 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
|
5110 otherwise, a Buffer object |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5111 (<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
|
5112 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5113 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
|
5114 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
|
5115 if encoding was not specified. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5116 </note> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5117 Otherwise, <literal>options</literal> is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5118 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5119 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5120 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5121 <tag-name><literal>encoding</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5122 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5123 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
|
5124 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
|
5125 <literal>hex</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5126 (<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
|
5127 <literal>base64</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5128 (<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
|
5129 <literal>base64url</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5130 (<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
|
5131 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5132 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5133 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5134 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5135 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
|
5136 by default is <literal>r</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5137 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5138 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5139 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5140 <example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5141 >> var fs = require('fs') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5142 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5143 >> var file = fs.readFileSync('/file/path.tar.gz') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5144 undefined |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
5145 >> 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
|
5146 true |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5147 </example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5148 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5149 |
3020
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5150 <tag-name id="fs_readsync"><literal>readSync(<value>fd</value>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5151 <value>buffer</value>, <value>offset</value>[, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5152 <value>length</value>[, <value>position</value>]])</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5153 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5154 Reads the content of a file path using file descriptor <literal>fd</literal>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5155 returns the number of bytes read |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5156 (<link doc="changes.xml" id="njs0.7.7">0.7.7</link>). |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5157 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5158 <list type="tag"> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5159 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5160 <tag-name><literal>buffer</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5161 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5162 the <literal>buffer</literal> value can be a |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5163 <literal>Buffer</literal>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5164 <literal>TypedArray</literal>, or |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5165 <literal>DataView</literal> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5166 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5167 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5168 <tag-name><literal>offset</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5169 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5170 is an <literal>integer</literal> representing |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5171 the position in buffer to write the data to |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5172 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5173 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5174 <tag-name><literal>length</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5175 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5176 is an <literal>integer</literal> representing |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5177 the number of bytes to read |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5178 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5179 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5180 <tag-name><literal>position</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5181 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5182 specifies where to begin reading from in the file, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5183 the value can be |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5184 <literal>integer</literal> or |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5185 <literal>null</literal>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5186 by default is <literal>null</literal>. |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5187 If <literal>position</literal> is <literal>null</literal>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5188 data will be read from the current file position, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5189 and the file position will be updated. |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5190 If position is an <literal>integer</literal>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5191 the file position will be unchanged |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5192 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5193 </list> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5194 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5195 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5196 |
2507 | 5197 <tag-name id="fs_realpathsync"><literal>realpathSync(<value>path</value>[, |
5198 <value>options</value>])</literal></tag-name> | |
5199 <tag-desc> | |
5200 Synchronously computes the canonical pathname by resolving | |
5201 <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
|
5202 <link url="http://man7.org/linux/man-pages/man3/realpath.3.html">realpath(3)</link>. |
2507 | 5203 The <literal>options</literal> argument can be a string specifying an encoding, |
5204 or an object with an encoding property specifying the character encoding | |
5205 to use for the path passed to the callback | |
5206 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
5207 </tag-desc> | |
5208 | |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5209 <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
|
5210 <value>newPath</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5211 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5212 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
|
5213 <literal>oldPath</literal> to <literal>newPath</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5214 (<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
|
5215 <example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5216 >> var fs = require('fs') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5217 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5218 >> var file = fs.renameSync('hello.txt', 'HelloWorld.txt') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5219 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5220 </example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5221 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5222 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5223 <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
|
5224 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5225 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
|
5226 (<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
|
5227 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5228 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5229 <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
|
5230 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5231 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5232 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5233 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
|
5234 for the specified <literal>path</literal> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5235 (<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
|
5236 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
|
5237 <literal>string</literal> or |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5238 <literal>buffer</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5239 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
|
5240 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5241 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5242 <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
|
5243 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5244 a boolean value which indicates whether |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5245 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
|
5246 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5247 by default is <literal>true</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5248 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5249 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5250 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5251 |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5252 <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
|
5253 <value>path</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5254 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5255 Synchronously creates the link called <literal>path</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5256 pointing to <literal>target</literal> using |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5257 <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
|
5258 (<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
|
5259 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
|
5260 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
5261 |
3020
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5262 <tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5263 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5264 Synchronously unlinks a file by <literal>path</literal> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5265 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5266 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5267 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5268 <tag-name id="fs_writefilesync"><literal>writeFileSync(<value>filename</value>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5269 <value>data</value>[, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5270 <value>options</value>])</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5271 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5272 Synchronously writes <literal>data</literal> to a file |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5273 with provided <literal>filename</literal>. |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5274 The <literal>data</literal> is expected to be a string |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5275 or a Buffer object (<link doc="changes.xml" id="njs0.4.4">0.4.4</link>). |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5276 If the file does not exist, it will be created, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5277 if the file exists, it will be replaced. |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5278 The <literal>options</literal> parameter is expected to be |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5279 an object with the following keys: |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5280 <list type="tag"> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5281 <tag-name><literal>mode</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5282 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5283 mode option, by default is <literal>0o666</literal> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5284 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5285 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5286 <tag-name><literal>flag</literal></tag-name> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5287 <tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5288 file system <link id="njs_api_fs_flags">flag</link>, |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5289 by default is <literal>w</literal> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5290 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5291 |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5292 </list> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5293 <example> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5294 >> var fs = require('fs') |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5295 undefined |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5296 >> var file = fs.writeFileSync('hello.txt', 'Hello world') |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5297 undefined |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5298 </example> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5299 </tag-desc> |
61996cb486f9
Reordered and added to toc fs methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
3015
diff
changeset
|
5300 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5301 <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
|
5302 <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
|
5303 <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
|
5304 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5305 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
|
5306 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
|
5307 (<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
|
5308 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5309 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5310 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5311 <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
|
5312 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5313 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
|
5314 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5315 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5316 <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
|
5317 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5318 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
|
5319 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5320 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5321 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5322 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5323 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5324 <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
|
5325 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5326 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
|
5327 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
|
5328 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
|
5329 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5330 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5331 <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
|
5332 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5333 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
|
5334 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
|
5335 <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
|
5336 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5337 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5338 <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
|
5339 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5340 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
|
5341 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
|
5342 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5343 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5344 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5345 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
|
5346 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5347 <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
|
5348 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5349 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5350 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5351 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5352 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5353 <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
|
5354 <value>string</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5355 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5356 <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
|
5357 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5358 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
|
5359 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
|
5360 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
|
5361 (<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
|
5362 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5363 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5364 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5365 <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
|
5366 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5367 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
|
5368 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5369 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5370 <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
|
5371 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5372 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
|
5373 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
|
5374 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5375 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5376 <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
|
5377 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5378 <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
|
5379 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5380 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5381 <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
|
5382 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5383 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
|
5384 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
|
5385 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5386 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5387 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5388 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5389 |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5390 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5391 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5392 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5393 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5394 <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
|
5395 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5396 <para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5397 <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
|
5398 a file or a subdirectory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5399 When |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5400 <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
|
5401 is called with the |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5402 <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
|
5403 option, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5404 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
|
5405 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5406 <list type= "bullet" compact="no"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5407 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5408 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5409 <literal>dirent.isBlockDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5410 <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
|
5411 a block device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5412 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5413 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5414 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5415 <literal>dirent.isCharacterDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5416 <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
|
5417 a character device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5418 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5419 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5420 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5421 <literal>dirent.isDirectory()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5422 <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
|
5423 a file system directory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5424 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5425 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5426 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5427 <literal>dirent.isFIFO()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5428 <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
|
5429 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
|
5430 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5431 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5432 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5433 <literal>dirent.isFile()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5434 <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
|
5435 a regular file. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5436 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5437 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5438 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5439 <literal>dirent.isSocket()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5440 <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
|
5441 a socket. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5442 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5443 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5444 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5445 <literal>dirent.isSymbolicLink()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5446 <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
|
5447 a symbolic link. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5448 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5449 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5450 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5451 <literal>dirent.name</literal>— |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5452 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
|
5453 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5454 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5455 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5456 </para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5457 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5458 </section> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5459 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
5460 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5461 <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
|
5462 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5463 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5464 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5465 <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
|
5466 <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
|
5467 <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
|
5468 <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
|
5469 <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
|
5470 <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
|
5471 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5472 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5473 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5474 <para> |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5475 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
|
5476 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
|
5477 (<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
|
5478 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
|
5479 <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
|
5480 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
|
5481 <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
|
5482 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
|
5483 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
|
5484 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
|
5485 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
|
5486 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5487 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5488 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5489 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5490 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5491 <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
|
5492 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5493 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
|
5494 to complete. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5495 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
|
5496 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5497 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5498 <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
|
5499 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5500 The numeric file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5501 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
|
5502 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5503 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5504 <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
|
5505 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5506 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5507 <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
|
5508 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5509 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
|
5510 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5511 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5512 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5513 <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
|
5514 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5515 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
|
5516 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
|
5517 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5518 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5519 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5520 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5521 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5522 <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
|
5523 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5524 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
|
5525 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
|
5526 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5527 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5528 <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
|
5529 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5530 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
|
5531 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
|
5532 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5533 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5534 <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
|
5535 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5536 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
|
5537 the value can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5538 <literal>integer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5539 <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5540 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
|
5541 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
|
5542 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
|
5543 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
|
5544 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5545 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5546 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5547 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
|
5548 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
|
5549 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5550 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5551 <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
|
5552 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5553 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
|
5554 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5555 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5556 <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
|
5557 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5558 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
|
5559 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5560 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5561 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5562 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5563 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5564 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5565 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5566 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5567 <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
|
5568 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5569 Fulfills with an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5570 <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
|
5571 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
|
5572 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5573 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5574 <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
|
5575 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5576 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5577 <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
|
5578 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5579 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
|
5580 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5581 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5582 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5583 <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
|
5584 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5585 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
|
5586 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5587 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5588 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5589 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5590 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5591 <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
|
5592 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5593 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
|
5594 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
|
5595 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5596 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5597 <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
|
5598 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5599 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
|
5600 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
|
5601 is an offset of |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5602 <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
|
5603 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5604 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5605 <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
|
5606 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5607 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
|
5608 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
|
5609 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5610 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5611 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5612 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
|
5613 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
|
5614 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
|
5615 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5616 <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
|
5617 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5618 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5619 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5620 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
|
5621 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5622 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5623 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5624 <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
|
5625 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5626 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
|
5627 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5628 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5629 <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
|
5630 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5631 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
|
5632 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5633 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5634 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5635 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5636 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5637 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5638 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5639 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
|
5640 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
|
5641 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5642 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5643 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5644 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5645 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5646 <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
|
5647 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5648 <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
|
5649 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5650 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
|
5651 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5652 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5653 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5654 <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
|
5655 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5656 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
|
5657 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
|
5658 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5659 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5660 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5661 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
|
5662 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
|
5663 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
|
5664 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5665 <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
|
5666 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5667 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5668 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5669 <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
|
5670 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5671 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
|
5672 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5673 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5674 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5675 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
|
5676 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5677 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5678 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5679 <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
|
5680 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5681 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
|
5682 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5683 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5684 <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
|
5685 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5686 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
|
5687 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5688 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5689 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5690 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5691 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5692 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5693 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5694 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
|
5695 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
|
5696 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5697 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5698 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5699 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5700 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5701 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5702 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5703 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5704 </section> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5705 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
5706 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5707 <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
|
5708 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5709 <para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5710 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
|
5711 The object is returned from |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5712 <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
|
5713 <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
|
5714 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5715 <list type= "bullet" compact="no"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5716 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5717 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5718 <literal>stats.isBlockDevice()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5719 <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
|
5720 a block device. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5721 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5722 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5723 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5724 <literal>stats.isDirectory()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5725 <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
|
5726 a file system directory. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5727 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5728 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5729 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5730 <literal>stats.isFIFO()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5731 <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
|
5732 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
|
5733 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5734 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5735 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5736 <literal>stats.isFile()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5737 <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
|
5738 a regular file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5739 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5740 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5741 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5742 <literal>stats.isSocket()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5743 <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
|
5744 a socket. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5745 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5746 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5747 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5748 <literal>stats.isSymbolicLink()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5749 <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
|
5750 a symbolic link. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5751 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5752 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5753 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5754 <literal>stats.dev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5755 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
|
5756 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5757 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5758 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5759 <literal>stats.ino</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5760 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
|
5761 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5762 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5763 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5764 <literal>stats.mode</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5765 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
|
5766 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5767 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5768 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5769 <literal>stats.nlink</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5770 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
|
5771 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5772 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5773 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5774 <literal>stats.uid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5775 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
|
5776 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5777 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5778 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5779 <literal>stats.gid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5780 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
|
5781 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5782 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5783 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5784 <literal>stats.rdev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5785 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
|
5786 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5787 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5788 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5789 <literal>stats.size</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5790 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
|
5791 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5792 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5793 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5794 <literal>stats.blksize</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5795 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
|
5796 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5797 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5798 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5799 <literal>stats.blocks</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5800 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
|
5801 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5802 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5803 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5804 <literal>stats.atimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5805 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
|
5806 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5807 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5808 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5809 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5810 <literal>stats.mtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5811 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
|
5812 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5813 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5814 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5815 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5816 <literal>stats.ctimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5817 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
|
5818 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5819 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5820 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5821 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5822 <literal>stats.birthtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5823 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
|
5824 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5825 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5826 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5827 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5828 <literal>stats.atime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5829 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
|
5830 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5831 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5832 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5833 <literal>stats.mtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5834 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
|
5835 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5836 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5837 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5838 <literal>stats.ctime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5839 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
|
5840 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5841 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5842 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5843 <literal>stats.birthtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5844 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
|
5845 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5846 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5847 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5848 </para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5849 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5850 </section> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5851 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
5852 |
2507 | 5853 <section id="access_const" name="File Access Constants"> |
5854 | |
5855 <para> | |
5856 The <link id="fs_accesssync"><literal>access()</literal></link> method | |
5857 can accept the following flags. | |
5858 These flags are exported by <literal>fs.constants</literal>: | |
5859 | |
5860 <list type= "bullet" compact="no"> | |
5861 | |
5862 <listitem> | |
5863 <literal>F_OK</literal>—indicates that the file | |
5864 is visible to the calling process, | |
5865 used by default if no mode is specified | |
5866 </listitem> | |
5867 | |
5868 <listitem> | |
5869 <literal>R_OK</literal>—indicates that the file can be | |
5870 read by the calling process | |
5871 </listitem> | |
5872 | |
5873 <listitem> | |
5874 <literal>W_OK</literal>—indicates that the file can be | |
5875 written by the calling process | |
5876 </listitem> | |
5877 | |
5878 <listitem> | |
5879 <literal>X_OK</literal>—indicates that the file can be | |
5880 executed by the calling process | |
5881 </listitem> | |
5882 | |
5883 </list> | |
5884 </para> | |
5885 | |
5886 </section> | |
5887 | |
5888 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5889 <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
|
5890 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5891 <para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5892 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
|
5893 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5894 <list type= "bullet" compact="no"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5895 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5896 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5897 <literal>a</literal>—open a file for appending. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5898 The file is created if it does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5899 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5900 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5901 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5902 <literal>ax</literal>—the same as <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5903 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5904 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5905 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5906 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5907 <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
|
5908 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
|
5909 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5910 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5911 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
5912 <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
|
5913 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5914 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5915 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5916 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
5917 <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
|
5918 in synchronous mode. |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5919 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
|
5920 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5921 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5922 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5923 <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
|
5924 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5925 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
|
5926 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5927 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5928 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5929 <literal>r</literal>—open a file for reading. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5930 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5931 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5932 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5933 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5934 <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
|
5935 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5936 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5937 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5938 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5939 <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
|
5940 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5941 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
|
5942 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5943 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5944 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5945 <literal>w</literal>—open a file for writing. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5946 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
|
5947 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5948 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5949 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5950 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5951 <literal>wx</literal>—the same as <literal>w</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5952 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5953 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5954 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5955 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5956 <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
|
5957 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
|
5958 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5959 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5960 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5961 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5962 <literal>wx+</literal>—the same as <literal>w+</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5963 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5964 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5965 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5966 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5967 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5968 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5969 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5970 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5971 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
5972 |
2583
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5973 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5974 <section id="querystring" name="Query String"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5975 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5976 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5977 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5978 <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
|
5979 <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
|
5980 <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
|
5981 <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
|
5982 <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
|
5983 <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
|
5984 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5985 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5986 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
5987 <para> |
2583
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5988 The Query String module provides support |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5989 for parsing and formatting URL query strings |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5990 (<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
|
5991 The Query String module object is returned by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5992 <literal>require('querystring')</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5993 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5994 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5995 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5996 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5997 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5998 <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
|
5999 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6000 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6001 <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
|
6002 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6003 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6004 <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
|
6005 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6006 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6007 <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
|
6008 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6009 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6010 <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
|
6011 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6012 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6013 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
|
6014 returns an escaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6015 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6016 <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
|
6017 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6018 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6019 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6020 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6021 <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
|
6022 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6023 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6024 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6025 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6026 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6027 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
|
6028 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6029 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6030 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6031 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6032 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
|
6033 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6034 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6035 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6036 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6037 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6038 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
|
6039 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6040 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6041 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6042 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6043 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
|
6044 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6045 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6046 <tag-name><literal>decodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6047 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6048 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6049 Function used |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6050 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
|
6051 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6052 <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
|
6053 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6054 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6055 <tag-name><literal>maxKeys</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6056 <value>number</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6057 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6058 the maximum number of keys to parse, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6059 by default is <literal>1000</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6060 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
|
6061 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6062 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6063 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6064 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
|
6065 to use the UTF-8 encoding, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6066 invalid UTF-8 sequences will be replaced with |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6067 the <literal>U+FFFD</literal> replacement character. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6068 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6069 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6070 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6071 For example, for the following query string |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6072 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6073 'foo=bar&abc=xyz&abc=123' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6074 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6075 the output will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6076 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6077 { |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6078 foo: 'bar', |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6079 abc: ['xyz', '123'] |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6080 } |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6081 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6082 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6083 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6084 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6085 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6086 <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
|
6087 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6088 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6089 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6090 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6091 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6092 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
|
6093 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6094 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6095 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6096 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6097 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
|
6098 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6099 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6100 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6101 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6102 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6103 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
|
6104 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6105 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6106 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6107 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6108 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
|
6109 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6110 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6111 <tag-name><literal>encodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6112 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6113 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6114 The function to use when converting |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6115 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
|
6116 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6117 <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
|
6118 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6119 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6120 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6121 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6122 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6123 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6124 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
|
6125 are encoded as UTF-8. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6126 If other encoding is required, then |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6127 <literal>encodeURIComponent</literal> option should be specified. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6128 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6129 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6130 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6131 For example, for the following command |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6132 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6133 querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], 123: '' }); |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6134 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6135 the query string will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6136 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6137 'foo=bar&baz=qux&baz=quux&123=' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6138 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6139 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6140 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6141 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6142 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6143 <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
|
6144 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6145 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6146 Performs decoding of URL percent-encoded characters |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6147 of the <literal>string</literal>, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6148 returns an unescaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6149 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6150 <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
|
6151 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6152 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6153 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6154 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6155 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6156 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6157 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6158 </section> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
6159 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6160 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6161 <section id="xml" name="XML"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6162 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6163 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6164 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6165 <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
|
6166 <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
|
6167 <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
|
6168 <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
|
6169 <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
|
6170 <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
|
6171 <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
|
6172 <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
|
6173 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6174 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6175 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6176 <para> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6177 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
|
6178 (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
|
6179 The XML module object is returned by |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6180 <literal>require('xml')</literal>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6181 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6182 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6183 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6184 Example: |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6185 <example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6186 const xml = require("xml"); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6187 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
|
6188 let doc = xml.parse(data); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6189 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6190 console.log(doc.note.to.$text) /* 'Tove' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6191 console.log(doc.note.to.$attr$b) /* 'bar' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6192 console.log(doc.note.$tags[1].$text) /* 'Jani' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6193 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6194 let dec = new TextDecoder(); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6195 let c14n = dec.decode(xml.exclusiveC14n(doc.note)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6196 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
|
6197 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6198 c14n = dec.decode(xml.exclusiveC14n(doc.note.to)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6199 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
|
6200 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6201 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
|
6202 console.log(c14n) /* '<note><from>Jani</from></note>' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6203 </example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6204 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6205 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6206 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6207 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6208 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6209 <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
|
6210 <value>Buffer</value>)</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6211 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6212 Parses a string or Buffer for an XML document, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6213 returns an |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6214 <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
|
6215 representing the parsed XML document. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6216 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6217 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6218 <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
|
6219 <value>excluding_node</value>])</literal></tag-name> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6220 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6221 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
|
6222 <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
|
6223 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
|
6224 <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
|
6225 <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
|
6226 around XML structure. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6227 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6228 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6229 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6230 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6231 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6232 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6233 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6234 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
|
6235 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6236 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6237 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6238 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6239 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6240 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6241 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6242 <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
|
6243 <value>excluding_node</value>[, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6244 <value>withComments</value> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6245 [,<value>prefix_list</value>]]])</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6246 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6247 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
|
6248 <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
|
6249 Canonicalization Version 1.0</link>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6250 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6251 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6252 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6253 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6254 <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
|
6255 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6256 is |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6257 <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
|
6258 <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
|
6259 around XML structure |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6260 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6261 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6262 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6263 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6264 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
|
6265 corresponding to the node and its children |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6266 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6267 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6268 <tag-name><literal>withComments</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6269 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6270 a boolean value, <literal>false</literal> by default. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6271 If <literal>true</literal>, canonicalization corresponds to |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6272 <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
|
6273 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
|
6274 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6275 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6276 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6277 <tag-name><literal>prefix_list</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6278 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6279 an optional string with a space separated namespace prefixes |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6280 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
|
6281 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6282 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6283 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6284 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6285 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6286 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6287 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6288 <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
|
6289 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6290 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6291 <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
|
6292 (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
|
6293 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6294 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6295 <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
|
6296 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6297 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6298 <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
|
6299 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
|
6300 (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
|
6301 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6302 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6303 <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
|
6304 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6305 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
|
6306 the root node of the document. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6307 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6308 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6309 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6310 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6311 <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
|
6312 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6313 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
|
6314 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6315 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6316 <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
|
6317 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6318 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
|
6319 <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
|
6320 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6321 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6322 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6323 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6324 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6325 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6326 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6327 <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
|
6328 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6329 An XMLNode wrapper object around XML tag node. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6330 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6331 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6332 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6333 <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
|
6334 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6335 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6336 <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
|
6337 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6338 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6339 <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
|
6340 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6341 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
|
6342 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6343 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
|
6344 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6345 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6346 <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
|
6347 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6348 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6349 <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
|
6350 <value>xyz</value>)</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6351 (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
|
6352 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6353 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6354 <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
|
6355 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6356 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
|
6357 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
|
6358 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6359 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6360 <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
|
6361 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6362 the name of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6363 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6364 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6365 <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
|
6366 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6367 the namespace of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6368 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6369 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6370 <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
|
6371 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6372 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
|
6373 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6374 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6375 <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
|
6376 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6377 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
|
6378 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6379 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
|
6380 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6381 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6382 <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
|
6383 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6384 an array of all children tags |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6385 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6386 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6387 <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
|
6388 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6389 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6390 <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
|
6391 <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
|
6392 <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
|
6393 (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
|
6394 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6395 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6396 <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
|
6397 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6398 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
|
6399 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6400 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
|
6401 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6402 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6403 <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
|
6404 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6405 the content of the node, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6406 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6407 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
|
6408 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6409 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6410 <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
|
6411 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6412 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6413 <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
|
6414 (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
|
6415 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6416 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6417 <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
|
6418 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6419 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
|
6420 (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
|
6421 <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
|
6422 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6423 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6424 <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
|
6425 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6426 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
|
6427 (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
|
6428 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6429 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6430 <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
|
6431 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6432 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
|
6433 (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
|
6434 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6435 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6436 <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
|
6437 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6438 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
|
6439 (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
|
6440 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
|
6441 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6442 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6443 <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
|
6444 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6445 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
|
6446 (<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
|
6447 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6448 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6449 <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
|
6450 <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
|
6451 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6452 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
|
6453 (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
|
6454 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
|
6455 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
|
6456 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6457 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6458 <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
|
6459 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6460 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
|
6461 (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
|
6462 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
|
6463 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6464 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6465 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6466 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6467 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6468 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6469 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6470 <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
|
6471 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6472 An XMLAttrs wrapper object around XML node attributes. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6473 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6474 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6475 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6476 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6477 <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
|
6478 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
6479 the attribute value of <value>abc</value> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6480 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6481 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6482 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6483 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6484 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6485 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6486 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6487 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6488 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6489 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6490 </section> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
6491 |
2951
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6492 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6493 <section id="zlib" name="zlib"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6494 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6495 <para> |
2989
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6496 <table width="100%"> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6497 <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
|
6498 <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
|
6499 <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
|
6500 <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
|
6501 </table> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6502 </para> |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6503 |
703d3450cd81
Added mini-tocs in sections of njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2988
diff
changeset
|
6504 <para> |
2951
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6505 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
|
6506 “deflate” and “inflate” algorithms |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6507 (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
|
6508 The zlib module object is returned by |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6509 <literal>require('zlib')</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6510 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6511 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6512 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6513 <list type="tag"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6514 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6515 <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
|
6516 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6517 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6518 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6519 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
|
6520 and does not append a zlib header. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6521 The buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6522 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6523 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6524 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6525 <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
|
6526 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6527 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
|
6528 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6529 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6530 <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
|
6531 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6532 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6533 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6534 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
|
6535 The Buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6536 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6537 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6538 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6539 <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
|
6540 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6541 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
|
6542 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6543 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6544 <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
|
6545 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6546 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6547 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
|
6548 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
|
6549 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6550 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6551 <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
|
6552 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6553 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6554 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
|
6555 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
|
6556 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6557 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6558 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6559 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6560 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6561 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6562 <section id="zlib_options" name="zlib options"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6563 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6564 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6565 <list type= "bullet" compact="no"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6566 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6567 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6568 <literal>chunkSize</literal>—is an integer, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6569 by default is <literal>1024</literal> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6570 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6571 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6572 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6573 <literal>dictionary</literal>—is a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6574 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6575 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6576 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6577 by default is empty |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6578 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6579 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6580 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6581 <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
|
6582 see <link id="zlib_compression_levels"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6583 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6584 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6585 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6586 <literal>memLevel</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6587 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
|
6588 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6589 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6590 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6591 <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
|
6592 see <link id="zlib_compression_strategy"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6593 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6594 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6595 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6596 <literal>windowBits</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6597 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
|
6598 for raw data, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6599 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
|
6600 for an ordinary stream |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6601 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6602 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6603 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6604 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6605 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6606 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6607 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6608 <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
|
6609 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6610 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6611 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6612 <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
|
6613 <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
|
6614 <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
|
6615 <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
|
6616 <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
|
6617 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6618 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6619 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6620 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6621 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6622 <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
|
6623 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6624 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6625 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6626 <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
|
6627 <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
|
6628 <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
|
6629 <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
|
6630 <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
|
6631 <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
|
6632 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6633 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6634 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6635 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6636 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6637 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
6638 |
2176 | 6639 </section> |
6640 | |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
6641 </article> |