Mercurial > hg > nginx-site
annotate xml/en/docs/njs/reference.xml @ 2963:c7bf5c9a1174
Linux packages: added Ubuntu 23.04 "lunar".
author | Konstantin Pavlov <thresh@nginx.com> |
---|---|
date | Wed, 10 May 2023 18:59:39 -0700 |
parents | b2bb7aa090da |
children | 576e06abd683 |
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" |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
12 rev="104"> |
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> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
41 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
|
42 <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
|
43 All string properties of the object are |
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
44 <link id="string">byte strings</link>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
45 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
46 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
47 |
2353 | 48 <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
|
49 <tag-desc> |
2872
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
50 request arguments object, read-only. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
51 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 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
|
56 </para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
57 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
58 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
59 For example, the query string |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
60 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
61 '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
|
62 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
63 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
|
64 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
65 {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
|
66 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
67 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
|
68 <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
|
69 and with the |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
70 <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
|
71 variable, for example: |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
72 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
73 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
74 import qs from 'querystring'; |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
75 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
76 function args(r) { |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
77 return qs.parse(r.variables.args); |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
78 } |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
79 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
80 The argument object |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
81 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
|
82 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
|
83 <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
|
84 <example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
85 r.variables.arg_foo |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
86 </example> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
87 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
|
88 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
|
89 case-insensitive, without percent-decoding. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
90 </para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
91 |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
92 <para> |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
93 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
|
94 the Query String |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
95 <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
|
96 method can be used. |
1e1a15c84515
Extended description of r.args in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2848
diff
changeset
|
97 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
98 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
99 |
2663
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
100 <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
|
101 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
102 after calling this function, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
103 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
|
104 <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
|
105 (<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
|
106 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
|
107 <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
|
108 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
109 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
110 <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
|
111 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
112 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
|
113 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
|
114 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
115 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
116 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
117 <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
|
118 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
119 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
|
120 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
121 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
122 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
123 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
124 <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
|
125 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
126 finishes sending a response to the client |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
127 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
128 |
2353 | 129 <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
|
130 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
131 incoming headers object, read-only. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
132 <para> |
2543
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
133 The <literal>Foo</literal> request header |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
134 can be accessed with the syntax: |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
135 <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
|
136 </para> |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
137 |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
138 <para> |
2735
ff357b676c2e
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2716
diff
changeset
|
139 The |
2543
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
140 <header>Authorization</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
141 <header>Content-Length</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
142 <header>Content-Range</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
143 <header>Content-Type</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
144 <header>ETag</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
145 <header>Expect</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
146 <header>From</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
147 <header>Host</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
148 <header>If-Match</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
149 <header>If-Modified-Since</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
150 <header>If-None-Match</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
151 <header>If-Range</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
152 <header>If-Unmodified-Since</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
153 <header>Max-Forwards</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
154 <header>Proxy-Authorization</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
155 <header>Referer</header>, |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
156 <header>Transfer-Encoding</header>, and |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
157 <header>User-Agent</header> |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
158 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
|
159 (<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
|
160 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
|
161 are separated by semicolon (<literal>;</literal>). |
f39c4724c0f8
Described multi-value headers in r.headersIn.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2537
diff
changeset
|
162 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
|
163 </para> |
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 |
2331 | 166 <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
|
167 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
168 outgoing headers object, writable. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
169 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
170 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
|
171 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
|
172 <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
|
173 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
174 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
175 <para> |
2894
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
176 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
|
177 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
|
178 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
|
179 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
180 <list type="bullet"> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
181 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
182 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
183 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
|
184 <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
|
185 <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
|
186 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
187 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
188 <listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
189 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
|
190 </listitem> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
191 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
192 </list> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
193 </para> |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
194 |
438a9cfa4fae
Added info about setting r.headersOut in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2888
diff
changeset
|
195 <para> |
2532
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
196 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
|
197 (<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
|
198 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
|
199 <example> |
2544
33347df1da9c
Relocated sentence in r.headers.Out, added dot, corrected quotes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2543
diff
changeset
|
200 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
|
201 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
202 where the output will be: |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
203 <example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
204 Foo: a |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
205 Foo: b |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
206 </example> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
207 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
|
208 will be deleted. |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
209 </para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
210 |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
211 <para> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
212 For standard response headers |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
213 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
|
214 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
215 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
|
216 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
|
217 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
|
218 Duplicate field values in |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
219 <header>Age</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
220 <header>Content-Encoding</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
221 <header>Content-Length</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
222 <header>Content-Type</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
223 <header>ETag</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
224 <header>Expires</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
225 <header>Last-Modified</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
226 <header>Location</header>, |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
227 <header>Retry-After</header> |
423d813dc8bb
Documented support for multi-value headers in r.headersOut.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2525
diff
changeset
|
228 response headers are ignored. |
2537
d6bbfd20c82f
Rephrased a sentence in r.headersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2532
diff
changeset
|
229 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
|
230 are separated by commas. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
231 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
232 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
233 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
234 <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
|
235 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
236 HTTP version, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
237 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
238 |
2888
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
239 <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
|
240 <tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
241 boolean value, true for |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
242 <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
|
243 locations |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
244 </tag-desc> |
88956e57f930
Documented r.internal in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2887
diff
changeset
|
245 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
246 <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
|
247 <tag-desc> |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
248 performs an |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
249 <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
|
250 redirect</link> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
251 to the specified <literal>uri</literal>. |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
252 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
|
253 it is considered a named location. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
254 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
|
255 <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
|
256 locations. |
2525
6ce28e0beec0
Updated description of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2509
diff
changeset
|
257 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
|
258 <para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
259 <note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
260 After redirect, |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
261 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
|
262 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
|
263 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
|
264 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
|
265 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
|
266 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
|
267 <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
|
268 <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
|
269 can be used. |
2685
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
270 </note> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
271 </para> |
5282d6d3d849
Improved descripion of r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2679
diff
changeset
|
272 |
2848
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
273 <para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
274 <note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
275 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
|
276 the method accepts escaped URIs. |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
277 </note> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
278 </para> |
c8d57f14c51b
Documented escaped URIs for r.internalRedirect in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2847
diff
changeset
|
279 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
280 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
281 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
282 <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
|
283 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
284 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
285 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
|
286 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
287 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
288 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
289 <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
|
290 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
291 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
|
292 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
293 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
294 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
295 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
296 <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
|
297 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
298 HTTP method, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
299 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
300 |
2497
805c4b84cc61
Added missing feature and links to njs-0.3.8 Changes.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2496
diff
changeset
|
301 <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
|
302 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
303 references the parent request object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
304 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
305 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
306 <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
|
307 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
308 client address, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
309 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
310 |
2628 | 311 <tag-name id="r_request_body"><literal>r.requestBody</literal></tag-name> |
312 <tag-desc> | |
313 the property is deprecated since | |
314 <link doc="changes.xml" id="njs0.5.0">0.5.0</link>, | |
315 the <link id="r_request_buffer"><literal>r.requestBuffer</literal></link> or | |
316 <link id="r_request_text"><literal>r.requestText</literal></link> property | |
317 should be used instead. | |
318 </tag-desc> | |
319 | |
320 <tag-name id="r_request_buffer"><literal>r.requestBuffer</literal></tag-name> | |
321 <tag-desc> | |
322 client request body if it has not been written to a temporary file | |
323 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
324 To ensure that the client request body is in memory, | |
325 its size should be limited by | |
326 <link doc="../http/ngx_http_core_module.xml" id="client_max_body_size"/>, | |
327 and a sufficient buffer size should be set using | |
328 <link doc="../http/ngx_http_core_module.xml" id="client_body_buffer_size"/>. | |
329 The property is available only in the | |
330 <link doc="../http/ngx_http_js_module.xml" id="js_content"/> directive. | |
331 </tag-desc> | |
332 | |
333 <tag-name id="r_request_text"><literal>r.requestText</literal></tag-name> | |
334 <tag-desc> | |
335 the same as <link id="r_request_buffer"><literal>r.requestBuffer</literal></link>, | |
336 but returns a <literal>string</literal>. | |
337 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
338 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 339 </tag-desc> |
340 | |
2546
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
341 <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
|
342 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
343 returns an array of key-value pairs |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
344 exactly as they were received from the client |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
345 (<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
|
346 <para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
347 For example, with the following request headers: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
348 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
349 Host: localhost |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
350 Foo: bar |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
351 foo: bar2 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
352 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
353 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
|
354 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
355 [ |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
356 ['Host', 'localhost'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
357 ['Foo', 'bar'], |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
358 ['foo', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
359 ] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
360 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
361 All <literal>foo</literal> headers |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
362 can be collected with the syntax: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
363 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
364 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
|
365 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
366 the output will be: |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
367 <example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
368 ['bar', 'bar2'] |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
369 </example> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
370 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
|
371 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
372 </para> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
373 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
374 |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
375 <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
|
376 <tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
377 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
|
378 (<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
|
379 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
|
380 duplicate field values are not merged. |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
381 </tag-desc> |
6093e9f3615e
Documented rawHeadersIn and rawHeadersOut in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2545
diff
changeset
|
382 |
2628 | 383 <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
|
384 <tag-desc> |
2628 | 385 the property is deprecated since |
386 <link doc="changes.xml" id="njs0.5.0">0.5.0</link>, | |
387 the <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> | |
388 or | |
389 the <link id="r_response_text"><literal>r.responseText</literal></link> | |
390 property | |
391 should be used instead. | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
392 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
393 |
2628 | 394 <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
|
395 <tag-desc> |
2628 | 396 holds the <link id="r_subrequest">subrequest</link> response body, |
397 read-only | |
398 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
399 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
|
400 <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
|
401 directive. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
402 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
403 |
2628 | 404 <tag-name id="r_response_text"><literal>r.responseText</literal></tag-name> |
405 <tag-desc> | |
406 the same as <link id="r_response_buffer"><literal>r.responseBuffer</literal></link> | |
407 but returns a string | |
408 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>). | |
409 Note that | |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
410 it may convert bytes invalid in UTF-8 encoding into the replacement character. |
2628 | 411 </tag-desc> |
412 | |
413 <tag-name id="r_return"><literal>r.return(status[, | |
414 string | Buffer])</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
415 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
416 sends the entire response |
2628 | 417 with the specified <literal>status</literal> to the client. |
418 The response can be a string or Buffer | |
419 (<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
|
420 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
421 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
|
422 (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
|
423 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
|
424 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
425 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
426 |
2628 | 427 <tag-name id="r_send"><literal>r.send(string |
428 | Buffer)</literal></tag-name> | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
429 <tag-desc> |
2628 | 430 sends a part of the response body to the client. |
431 The data sent can be a string or Buffer | |
432 (<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
|
433 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
434 |
2663
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
435 <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
|
436 <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
|
437 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
438 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
|
439 (<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
|
440 The actual forwarding happens later, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
441 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
|
442 <para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
443 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
|
444 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
|
445 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
|
446 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
|
447 <list type="tag"> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
448 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
449 <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
|
450 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
451 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
452 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
|
453 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
454 |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
455 <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
|
456 <tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
457 boolean, |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
458 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
|
459 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
460 </list> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
461 </para> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
462 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
|
463 <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
|
464 </tag-desc> |
a33d8f0f48b2
Documented r.done and r.sendBuffer in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2653
diff
changeset
|
465 |
2571
3e47eecce384
Added id to r.sendHeader in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2570
diff
changeset
|
466 <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
|
467 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
468 sends the HTTP headers to the client |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
469 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
470 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
471 <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
|
472 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
473 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
|
474 <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
|
475 (<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
|
476 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
477 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
|
478 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
479 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
480 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
481 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
|
482 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
483 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
484 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
485 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
486 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
487 <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
|
488 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
489 status, writable |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
490 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
491 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
492 <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
|
493 <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
|
494 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
495 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
|
496 <literal>options</literal>, and installs |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
497 an optional completion <literal>callback</literal>. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
498 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
499 <para> |
2340
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
500 A |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
501 <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
|
502 shares its input headers with the client request. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
503 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
|
504 <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
|
505 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
506 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
|
507 <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
|
508 directive can be used. |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
509 </para> |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
510 |
537130c40c1f
Updated r.subrequest desctiption in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2338
diff
changeset
|
511 <para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
512 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
|
513 holds the subrequest arguments string. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
514 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
|
515 an object with the following keys: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
516 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
517 <tag-name><literal>args</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
518 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
519 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
|
520 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
521 <tag-name><literal>body</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
522 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
523 request body, |
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
524 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
|
525 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
526 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
527 <tag-name><literal>method</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
528 <tag-desc> |
2344
ea8ccaac18b4
Added default values for r.subrequest options in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2340
diff
changeset
|
529 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
|
530 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
531 |
2507 | 532 <tag-name><literal>detached</literal></tag-name> |
533 <tag-desc> | |
534 boolean flag (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>), | |
535 if <literal>true</literal>, the created subrequest is a detached subrequest. | |
536 Responses to detached subrequests are ignored. | |
537 Unlike ordinary subrequests, a detached subrequest | |
538 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
|
539 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
|
540 are mutually exclusive. |
2507 | 541 </tag-desc> |
542 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
543 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
544 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
545 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
546 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
547 The completion <literal>callback</literal> receives |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
548 a subrequest response object with methods and properties |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
549 identical to the parent request object. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
550 </para> |
2484
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
551 |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
552 <para> |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
553 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
|
554 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
|
555 the <literal>Promise</literal> object |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
556 that resolves to the subrequest response object is returned. |
2aa02672d54f
Added a note to r.subrequest in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2446
diff
changeset
|
557 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
558 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
559 |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
560 <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
|
561 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
562 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
|
563 in request, |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
564 <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
|
565 read-only |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
566 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
567 |
2628 | 568 <tag-name id="r_raw_variables"><literal>r.rawVariables{}</literal></tag-name> |
569 <tag-desc> | |
570 nginx <link id="r_variables">variables</link> as Buffers, | |
571 writable | |
572 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
573 </tag-desc> | |
574 | |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
575 <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
|
576 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
577 <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
|
578 (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
|
579 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
580 <para> |
2926
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
581 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
|
582 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
|
583 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
584 r.variables['foo'] |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
585 r.variables.foo |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
586 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
587 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
|
588 and unreferenced variables differently. |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
589 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
|
590 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
|
591 For example, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
592 <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
|
593 variable is only accessed from njs, |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
594 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
|
595 But, when the |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
596 <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
|
597 is referenced, for example: |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
598 <example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
599 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
|
600 </example> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
601 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
|
602 </para> |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
603 |
237a77d8565b
Extended description of r_variables in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2925
diff
changeset
|
604 <para> |
2693
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
605 A variable is writable if: |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
606 <list type="bullet"> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
607 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
608 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
609 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
|
610 <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
|
611 <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
|
612 (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
|
613 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
614 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
615 <listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
616 it is referenced in nginx configuration file |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
617 </listitem> |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
618 |
3cbd6e440581
Documented the js_var directive.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2689
diff
changeset
|
619 </list> |
2689
7e271437f12e
Updated writable variables info in r.variables and s.variables.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2688
diff
changeset
|
620 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
|
621 <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
|
622 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
623 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
624 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
625 <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
|
626 <tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
627 writes a <literal>string</literal> to the error log |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
628 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
|
629 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
630 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
631 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
632 <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
|
633 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
634 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
|
635 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
636 </para> |
2545
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
637 </tag-desc> |
dca5a7053a6c
Sorted alphabetically njs http methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2544
diff
changeset
|
638 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
639 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
640 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
641 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
642 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
643 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
644 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
645 <section id="stream" name="Stream Session"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
646 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
647 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
648 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
|
649 <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
|
650 module. |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
651 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
|
652 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
653 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
654 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
655 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
656 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
657 <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
|
658 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
659 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
660 <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
|
661 (<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
|
662 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
663 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
664 <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
|
665 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
666 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
667 <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
|
668 (<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
|
669 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
670 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
671 <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
|
672 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
673 an alias to |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
674 <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
|
675 (<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
|
676 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
677 |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
678 <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
|
679 <tag-desc> |
2670
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
680 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
|
681 <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
|
682 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
|
683 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
|
684 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
|
685 <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
|
686 <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
|
687 are processed |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
688 (<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
|
689 <para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
690 Possible code values: |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
691 <list type="bullet"> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
692 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
693 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
694 <literal>0</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
695 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
|
696 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
697 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
698 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
699 <literal>-5</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
700 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
|
701 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
702 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
703 <listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
704 <literal>403</literal>— |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
705 access is forbidden |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
706 </listitem> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
707 |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
708 </list> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
709 </para> |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
710 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
|
711 <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
|
712 or |
e53592a1d979
Improved descriptions of s.done, s.allow, s.decline, s.deny.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2668
diff
changeset
|
713 <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
|
714 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
715 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
716 <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
|
717 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
718 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
|
719 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
|
720 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
721 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
722 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
723 <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
|
724 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
725 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
|
726 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
727 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
728 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
729 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
730 <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
|
731 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
732 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
|
733 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
|
734 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
735 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
736 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
737 <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
|
738 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
739 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
|
740 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
741 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
742 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
743 |
2881
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
744 <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
|
745 <tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
746 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
|
747 (<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
|
748 </tag-desc> |
e59e8645055d
Relocated note from s.off to s.log in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2877
diff
changeset
|
749 |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
750 <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
|
751 <value>callback</value>)</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
752 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
753 registers a <literal>callback</literal> |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
754 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
|
755 (<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
|
756 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
757 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
758 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
|
759 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
760 <tag-name><literal>upload</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
761 <tag-desc> |
2628 | 762 new data (string) from a client |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
763 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
764 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
765 <tag-name><literal>download</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
766 <tag-desc> |
2628 | 767 new data (string) to a client |
768 </tag-desc> | |
769 | |
770 <tag-name><literal>upstream</literal></tag-name> | |
771 <tag-desc> | |
772 new data (Buffer) from a client | |
773 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
774 </tag-desc> | |
775 | |
776 <tag-name><literal>downstream</literal></tag-name> | |
777 <tag-desc> | |
778 new data (Buffer) to a client | |
779 (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
|
780 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
781 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
782 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
783 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
784 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
785 <para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
786 The completion callback has the following prototype: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
787 <literal>callback(data, flags)</literal>, where |
2628 | 788 <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
|
789 <literal>flags</literal> is an object |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
790 with the following properties: |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
791 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
792 <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
|
793 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
794 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
|
795 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
796 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
797 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
798 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
799 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
800 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
801 <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
|
802 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
803 client address, read-only |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
804 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
805 |
2628 | 806 <tag-name id="s_raw_variables"><literal>s.rawVariables</literal></tag-name> |
807 <tag-desc> | |
808 nginx <link id="s_variables">variables</link> as Buffers, | |
809 writable | |
810 (since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>) | |
811 </tag-desc> | |
812 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
813 <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
|
814 <value>options</value>])</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
815 <tag-desc> |
2667
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
816 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
|
817 the forward direction: |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
818 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
|
819 (<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
|
820 The actual forwarding happens later, |
2085eb315672
Updated description of s.send in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2666
diff
changeset
|
821 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
|
822 <para> |
2628 | 823 The data can be a string or Buffer |
824 (<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
|
825 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
|
826 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
|
827 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
|
828 <list type="tag"> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
829 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
830 <tag-name><literal>last</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
831 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
832 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
833 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
|
834 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
835 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
836 <tag-name><literal>flush</literal></tag-name> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
837 <tag-desc> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
838 boolean, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
839 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
|
840 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
841 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
842 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
843 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
|
844 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
845 |
2902
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
846 <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
|
847 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
848 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
|
849 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
|
850 (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
|
851 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
852 |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
853 <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
|
854 <tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
855 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
|
856 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
|
857 (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
|
858 </tag-desc> |
843bf979dcaa
Added s.sendDownstream and s.sendUpstream to njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2894
diff
changeset
|
859 |
2665
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
860 <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
|
861 <tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
862 session status code, an alias to the |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
863 <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
|
864 variable, |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
865 read only |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
866 (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
|
867 </tag-desc> |
529114f1108a
Documented s.status property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2663
diff
changeset
|
868 |
2800
3a146e49f9d4
Corrected syntax of r.setReturnValue and s.setReturnValue.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2792
diff
changeset
|
869 <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
|
870 <tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
871 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
|
872 <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
|
873 (<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
|
874 Unlike an ordinary return statement, |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
875 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
|
876 For example: |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
877 <example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
878 async function js_set(r) { |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
879 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
|
880 r.setReturnValue(digest); |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
881 } |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
882 </example> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
883 </tag-desc> |
bc79ab31073a
Documented r.setReturnValue and s.setReturnValue in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2775
diff
changeset
|
884 |
2338
39ac205f90b7
Documented that r.variables{} and s.variables{} are writable.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2337
diff
changeset
|
885 <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
|
886 <tag-desc> |
2925
3be061a0941a
Added link to varindex in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2910
diff
changeset
|
887 <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
|
888 (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
|
889 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
|
890 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
|
891 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
|
892 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
893 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
894 <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
|
895 <tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
896 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
|
897 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
|
898 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
899 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
900 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
901 <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
|
902 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
903 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
|
904 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
905 </para> |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
906 </tag-desc> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
907 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
908 </list> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
909 </para> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
910 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
911 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
912 |
2628 | 913 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
914 <section id="headers" name="Headers"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
915 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
916 <para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
917 The <literal>Headers</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
918 <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
|
919 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
|
920 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
921 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
922 <para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
923 A new <literal>Headers</literal> object can be created using |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
924 the <literal>Headers()</literal> constructor |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
925 (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
|
926 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
927 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
928 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
929 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
930 <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
|
931 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
932 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
|
933 <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
934 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
|
935 (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
|
936 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
937 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
938 <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
|
939 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
940 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
|
941 (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
|
942 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
943 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
944 <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
|
945 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
946 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
|
947 separated by a comma and a space. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
948 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
949 |
2941
8f50cc590cd7
Updated njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2935
diff
changeset
|
950 <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
|
951 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
952 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
|
953 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
954 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
955 <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
|
956 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
957 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
|
958 in the <literal>Headers</literal> object |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
959 (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
|
960 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
961 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
962 <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
|
963 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
964 Returns a boolean value |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
965 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
|
966 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
967 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
968 <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
|
969 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
970 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
|
971 the <literal>Headers</literal> object, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
972 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
|
973 (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
|
974 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
975 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
976 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
977 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
978 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
979 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
980 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
981 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
982 <section id="request" name="Request"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
983 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
984 <para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
985 The <literal>Request</literal> interface of the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
986 <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
|
987 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
|
988 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
989 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
990 <para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
991 A new <literal>Request</literal> object can be created using |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
992 the <literal>Request()</literal> constructor |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
993 with the following properties and methods: |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
994 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
995 <list type="tag"> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
996 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
997 <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
|
998 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
999 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
|
1000 an <literal>ArrayBuffer</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1001 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1002 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1003 <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
|
1004 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1005 A boolean value, <literal>true</literal> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1006 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
|
1007 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1008 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1009 <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
|
1010 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1011 Contains the cache mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1012 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1013 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1014 <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
|
1015 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1016 Contains the credentials of the request, |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1017 by default is <literal>same-origin</literal>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1018 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1019 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1020 <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
|
1021 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1022 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
|
1023 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1024 <link id="request"><literal>Request</literal></link>. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1025 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1026 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1027 <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
|
1028 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1029 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
|
1030 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
|
1031 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1032 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1033 <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
|
1034 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1035 Contains the request method. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1036 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1037 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1038 <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
|
1039 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1040 Contains the mode of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1041 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1042 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1043 <tag-name id="request_text"><literal>text()</literal></tag-name> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1044 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1045 Returns a <literal>Promise</literal> that resolves with a |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1046 string representation of the request body. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1047 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1048 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1049 <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
|
1050 <tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1051 Contains the URL of the request. |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1052 </tag-desc> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1053 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1054 </list> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1055 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1056 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1057 </section> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1058 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1059 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1060 <section id="response" name="Response"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1061 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1062 <para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1063 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
|
1064 <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
|
1065 </para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1066 |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1067 <para> |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1068 A new <literal>Response</literal> object can be created using |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1069 the <literal>Response()</literal> constructor |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1070 (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
|
1071 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
|
1072 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1073 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1074 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1075 <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
|
1076 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1077 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
|
1078 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
|
1079 an <literal>ArrayBuffer</literal>. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1080 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1081 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1082 <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
|
1083 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1084 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1085 if the body was read. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1086 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1087 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1088 <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
|
1089 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1090 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
|
1091 associated with the |
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1092 <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
|
1093 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1094 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1095 <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
|
1096 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1097 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
|
1098 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
|
1099 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
|
1100 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1101 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1102 <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
|
1103 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1104 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1105 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
|
1106 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1107 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1108 <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
|
1109 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1110 A boolean value, <literal>true</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1111 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
|
1112 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1113 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1114 <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
|
1115 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1116 The status code of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1117 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1118 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1119 <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
|
1120 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1121 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
|
1122 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1123 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1124 <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
|
1125 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1126 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
|
1127 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
|
1128 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1129 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1130 <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
|
1131 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1132 The type of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1133 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1134 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1135 <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
|
1136 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1137 The URL of the response. |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1138 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1139 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1140 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1141 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1142 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1143 </section> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1144 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1145 |
2628 | 1146 <section id="ngx" name="ngx"> |
1147 | |
1148 <para> | |
1149 The <literal>ngx</literal> global object is available | |
1150 since <link doc="changes.xml" id="njs0.5.0">0.5.0</link>. | |
1151 <list type="tag"> | |
1152 | |
2910
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1153 <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
|
1154 <tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1155 a string containing the file path to |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1156 <link doc="../configure.xml" id="prefix">nginx configuration prefix</link>— |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1157 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
|
1158 (<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
|
1159 </tag-desc> |
5f1d472f6a97
Documented ngx.conf_prefix property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2904
diff
changeset
|
1160 |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1161 <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
|
1162 [<value>options</value>])</literal></tag-name> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1163 <tag-desc> |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1164 <para> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1165 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
|
1166 (<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
|
1167 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
|
1168 (<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
|
1169 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
|
1170 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
|
1171 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
|
1172 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
|
1173 redirects are not handled. |
2958
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1174 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1175 |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1176 <para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1177 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
|
1178 it is determined using a |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1179 <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
|
1180 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
|
1181 <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
|
1182 directive should be configured |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1183 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
|
1184 </para> |
b2bb7aa090da
Updated ngx.fetch description in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2952
diff
changeset
|
1185 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1186 <para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1187 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
|
1188 with the following keys: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1189 <list type="tag"> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1190 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1191 <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
|
1192 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1193 request body, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1194 by default is empty |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1195 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1196 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1197 <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
|
1198 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1199 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
|
1200 by default is <literal>4096</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1201 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1202 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1203 <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
|
1204 <tag-desc> |
2933
386ba17fac23
Documented Request, Response, Headers in Fetch API.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2932
diff
changeset
|
1205 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
|
1206 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1207 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1208 <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
|
1209 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1210 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
|
1211 by default is <literal>32768</literal> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1212 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1213 |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1214 <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
|
1215 <tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1216 HTTP method, |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1217 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
|
1218 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1219 |
2775
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1220 <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
|
1221 <tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1222 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
|
1223 by default is <literal>true</literal> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1224 (<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
|
1225 </tag-desc> |
9ce9239c6b7b
Documented "verify" key in ngx_fetch.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2774
diff
changeset
|
1226 |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1227 </list> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1228 Example: |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1229 <example> |
2840
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1230 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
|
1231 let body = await reply.text(); |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1232 |
3b705c0a5af7
Updated example for ngx.fetch in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2818
diff
changeset
|
1233 r.return(200, body); |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1234 </example> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1235 </para> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1236 </tag-desc> |
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1237 |
2628 | 1238 <tag-name id="ngx_log"><literal>ngx.log</literal>(<value>level</value>, |
1239 <value>message</value>)</tag-name> | |
1240 <tag-desc> | |
1241 Writes a message to the error log with the specified level of logging. | |
1242 The <value>level</value> parameter specifies one of the log levels, | |
1243 the <value>message</value> parameter can be a string or Buffer. | |
1244 The following log levels can be specified: | |
1245 <literal>ngx.INFO</literal>, | |
1246 <literal>ngx.WARN</literal>, and | |
1247 <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
|
1248 <para> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1249 <note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1250 As nginx has a |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1251 <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
|
1252 maximum line length limit, |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1253 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
|
1254 </note> |
0280b6c71d38
Added note about string length to log methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2873
diff
changeset
|
1255 </para> |
2628 | 1256 </tag-desc> |
2653
9fc25ea7a92c
Documented ngx.fetch and Response interface in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2647
diff
changeset
|
1257 |
2628 | 1258 </list> |
1259 </para> | |
1260 | |
1261 </section> | |
1262 | |
2247
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1263 </section> |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1264 |
0f16ef9a8dbe
Created "nginx objects" section in reference.xml.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2246
diff
changeset
|
1265 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
1266 <section id="builtin_objects" name="built-in objects"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1267 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
1268 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1269 <section id="builtin_crypto" name="crypto"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1270 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1271 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1272 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
|
1273 that allows using cryptographic functionality |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1274 (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
|
1275 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1276 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1277 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1278 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1279 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1280 <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
|
1281 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1282 Gets cryptographically strong random values. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1283 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
|
1284 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
|
1285 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1286 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1287 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1288 <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
|
1289 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1290 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1291 <literal>Int8Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1292 <literal>Int16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1293 <literal>Uint16Array</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1294 <literal>Int32Array</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1295 <literal>Uint32Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1296 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1297 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1298 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1299 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1300 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1301 <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
|
1302 <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
|
1303 <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
|
1304 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1305 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
|
1306 using the provided |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1307 <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
|
1308 <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
|
1309 Returns a <literal>Promise</literal> that fulfills with |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1310 an <literal>ArrayBuffer</literal> containing the ciphertext. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1311 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1312 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1313 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1314 <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
|
1315 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1316 an object that specifies |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1317 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
|
1318 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1319 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1320 <listitem id="rsa_oaep_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1321 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1322 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1323 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1324 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1325 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1326 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1327 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1328 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1329 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1330 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1331 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1332 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1333 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1334 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1335 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1336 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1337 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1338 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1339 <listitem id="aes_ctr_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1340 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1341 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1342 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1343 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1344 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1345 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1346 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1347 should be set to <literal>AES-CTR</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1348 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1349 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1350 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1351 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1352 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1353 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1354 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1355 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1356 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
|
1357 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
|
1358 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1359 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1360 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
|
1361 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
|
1362 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1363 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1364 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1365 <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
|
1366 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1367 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
|
1368 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1369 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1370 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1371 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1372 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1373 <listitem id="aes_cbc_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1374 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
|
1375 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1376 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1377 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1378 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1379 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1380 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1381 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1382 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1383 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1384 <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
|
1385 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1386 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1387 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1388 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1389 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1390 However, it need not be secret, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1391 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
|
1392 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1393 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1394 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1395 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1396 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1397 <listitem id="aes_gcm_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1398 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
|
1399 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1400 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1401 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1402 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1403 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1404 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1405 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1406 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1407 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1408 <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
|
1409 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1410 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1411 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1412 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1413 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
|
1414 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1415 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1416 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1417 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1418 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1419 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1420 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1421 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1422 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
|
1423 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1424 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
|
1425 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1426 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
|
1427 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1428 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
1429 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1430 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
|
1431 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1432 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1433 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1434 <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
|
1435 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
|
1436 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
|
1437 and used for authentication in the corresponding decryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1438 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1439 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1440 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1441 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1442 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1443 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1444 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1445 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1446 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
|
1447 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1448 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1449 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1450 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1451 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1452 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1453 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1454 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1455 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1456 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1457 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1458 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1459 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1460 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1461 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1462 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1463 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1464 <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
|
1465 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1466 a <literal>CryptoKey</literal> that contains |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1467 the key to be used for encryption |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1468 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1469 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1470 <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
|
1471 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1472 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1473 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1474 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1475 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1476 that contains |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1477 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
|
1478 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1479 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1480 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1481 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1482 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1483 <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
|
1484 <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
|
1485 <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
|
1486 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1487 Decrypts encrypted data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1488 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
|
1489 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1490 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1491 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1492 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1493 <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
|
1494 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1495 an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1496 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
|
1497 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
|
1498 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
|
1499 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1500 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1501 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1502 for <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1503 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1504 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1505 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1506 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1507 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1508 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1509 should be set to <literal>RSA-OAEP</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1510 <para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1511 <example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1512 crypto.subtle.encrypt({name: "RSA-OAEP"}, key, data) |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1513 </example> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1514 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1515 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1516 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1517 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1518 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1519 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1520 for <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1521 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1522 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1523 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1524 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1525 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1526 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1527 should be set to <literal>AES-CTR</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1528 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1529 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1530 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1531 <literal>counter</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1532 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1533 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1534 <literal>DataView</literal> — |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1535 the initial value of the counter block, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1536 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
|
1537 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
|
1538 and the rest is used for the nonce. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1539 For example, if length is set to 64, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1540 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
|
1541 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
|
1542 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1543 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1544 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1545 <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
|
1546 that are used for the actual counter. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1547 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
|
1548 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1549 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1550 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1551 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1552 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1553 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1554 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
|
1555 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1556 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1557 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1558 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1559 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1560 should be set to <literal>AES-CBC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1561 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1562 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1563 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1564 <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
|
1565 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1566 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1567 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1568 must be 16 bytes, unpredictable, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1569 and preferably cryptographically random. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1570 However, it need not be secret |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1571 (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
|
1572 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1573 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1574 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1575 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1576 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1577 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1578 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
|
1579 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1580 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1581 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1582 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1583 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1584 should be set to <literal>AES-GCM</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1585 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1586 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1587 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1588 <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
|
1589 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1590 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1591 <literal>DataView</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1592 must be 16 bytes, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1593 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
|
1594 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1595 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1596 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1597 <literal>additionalData</literal> (optional) is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1598 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1599 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1600 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1601 that contains additional data that |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1602 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
|
1603 If <literal>additionalData</literal> is specified, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1604 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
|
1605 <literal>decrypt()</literal>: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1606 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
|
1607 does not match the original data, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1608 the decryption will throw an exception. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
1609 The bit length of <literal>additionalData</literal> |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1610 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
|
1611 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1612 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1613 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1614 <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
|
1615 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
|
1616 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
|
1617 and used for authentication in the corresponding decryption. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1618 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1619 <literal>32</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1620 <literal>64</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1621 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1622 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1623 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1624 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1625 <literal>128</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1626 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
|
1627 <literal>96</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1628 <literal>104</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1629 <literal>112</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1630 <literal>120</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1631 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1632 although |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1633 <literal>32</literal> or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1634 <literal>64</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1635 bits may be acceptable in some applications. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1636 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1637 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1638 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1639 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1640 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1641 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1642 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1643 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1644 <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
|
1645 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1646 a <literal>CryptoKey</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1647 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
|
1648 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
|
1649 <literal>privateKey</literal> property of the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1650 <literal>CryptoKeyPair</literal> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1651 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1652 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1653 <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
|
1654 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1655 an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1656 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1657 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1658 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1659 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
|
1660 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1661 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1662 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1663 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1664 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1665 <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
|
1666 <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
|
1667 <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
|
1668 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1669 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
|
1670 Returns a <literal>Promise</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1671 which will be fulfilled with an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1672 <literal>ArrayBuffer</literal> that contains the derived bits. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1673 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1674 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1675 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1676 <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
|
1677 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1678 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
|
1679 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1680 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1681 <listitem id="hkdf_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1682 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1683 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1684 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1685 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1686 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1687 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1688 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1689 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1690 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1691 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1692 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1693 <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
|
1694 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1695 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1696 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1697 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1698 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1699 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1700 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1701 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1702 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1703 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1704 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1705 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1706 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
|
1707 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
|
1708 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1709 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1710 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1711 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1712 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1713 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1714 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1715 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1716 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1717 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
|
1718 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1719 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1720 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
|
1721 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1722 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1723 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1724 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1725 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1726 <listitem id="pbkdf2_params"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1727 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1728 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1729 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1730 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1731 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1732 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1733 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1734 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1735 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1736 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1737 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1738 <literal>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
|
1739 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1740 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1741 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1742 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1743 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1744 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1745 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1746 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1747 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1748 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1749 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1750 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1751 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1752 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
|
1753 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1754 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1755 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1756 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1757 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1758 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
|
1759 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1760 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1761 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1762 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1763 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1764 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1765 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1766 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1767 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1768 <tag-name id="crypto_derive_bits_basekey"><literal>baseKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1769 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1770 is a <literal>CryptoKey</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1771 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1772 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1773 for example, for <literal>PBKDF2</literal> it might be a password, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1774 imported as a <literal>CryptoKey</literal> using |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1775 <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
|
1776 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1777 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1778 <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
|
1779 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1780 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
|
1781 For browsers compatibility, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1782 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
|
1783 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1784 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1785 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1786 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1787 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1788 <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
|
1789 <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
|
1790 <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
|
1791 <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
|
1792 <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
|
1793 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1794 Derives a secret key from a master key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1795 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1796 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1797 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1798 <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
|
1799 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1800 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
|
1801 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1802 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1803 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1804 for <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1805 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1806 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1807 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1808 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1809 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1810 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1811 should be set to <literal>HKDF</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1812 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1813 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1814 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1815 <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
|
1816 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1817 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1818 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1819 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1820 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1821 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1822 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1823 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1824 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1825 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1826 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1827 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1828 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
|
1829 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
|
1830 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1831 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1832 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1833 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1834 <literal>info</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1835 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1836 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1837 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1838 that represents application-specific contextual information |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1839 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
|
1840 and enables deriving different keys for different contexts |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1841 while using the same input key material. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1842 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
|
1843 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1844 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1845 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1846 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1847 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1848 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1849 for <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1850 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1851 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1852 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1853 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1854 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1855 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1856 should be set to <literal>PBKDF2</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1857 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1858 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1859 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1860 <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
|
1861 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1862 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1863 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1864 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1865 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1866 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1867 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1868 <literal>salt</literal> is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1869 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1870 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1871 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1872 that represents random or pseudo-random value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1873 of at least <literal>16</literal> bytes. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1874 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
|
1875 salt does not need to be kept secret. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1876 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1877 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1878 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1879 <literal>iterations</literal> is a <literal>number</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1880 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
|
1881 in <literal>deriveKey()</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1882 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1883 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1884 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1885 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1886 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1887 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1888 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1889 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1890 <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
|
1891 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1892 is a <literal>CryptoKey</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1893 that represents the input to the derivation algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1894 - the initial key material for the derivation function: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1895 for example, for <literal>PBKDF2</literal> it might be a password, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1896 imported as a <literal>CryptoKey</literal> using |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
1897 <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
|
1898 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1899 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1900 <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
|
1901 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1902 is an object |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1903 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
|
1904 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1905 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1906 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1907 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1908 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1909 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1910 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1911 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1912 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1913 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1914 should be set to <literal>HMAC</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1915 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1916 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1917 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1918 <literal>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
|
1919 <literal>SHA-1</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1920 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1921 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1922 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1923 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1924 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1925 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1926 <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
|
1927 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
|
1928 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
|
1929 the block size of the chozen hash function |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1930 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1931 </list> |
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 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1934 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1935 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1936 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1937 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1938 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1939 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1940 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1941 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1942 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1943 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1944 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1945 <literal>name</literal> is a string, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1946 should be set to |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1947 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1948 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1949 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1950 depending on the algorithm used |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1951 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1952 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1953 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1954 <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
|
1955 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
|
1956 <literal>128</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1957 <literal>192</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1958 <literal>256</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1959 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1960 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1961 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1962 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1963 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1964 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1965 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1966 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1967 <tag-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
|
1968 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1969 is a boolean value |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1970 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
|
1971 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1972 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1973 <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
|
1974 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1975 is an <literal>Array</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1976 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
|
1977 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
|
1978 set in <literal>derivedKeyAlgorithm</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1979 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1980 <list type="tag"> |
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 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1983 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1984 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1985 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1986 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1987 <tag-name><literal>decrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1988 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1989 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1990 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1991 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1992 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1993 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1994 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1995 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1996 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1997 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1998 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
1999 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2000 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2001 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2002 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2003 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2004 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2005 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2006 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2007 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2008 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2009 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2010 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2011 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2012 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2013 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2014 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2015 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2016 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2017 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2018 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2019 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2020 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2021 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2022 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2023 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2024 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2025 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2026 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2027 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2028 <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
|
2029 <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
|
2030 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2031 Generates a digest of the given data. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2032 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
|
2033 and the data to digest. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2034 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
|
2035 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2036 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2037 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2038 <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
|
2039 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2040 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
|
2041 <literal>SHA-1</literal> (not for cryptographic applications), |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2042 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2043 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2044 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2045 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2046 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2047 <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
|
2048 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2049 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2050 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2051 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2052 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2053 that contains the data to be digested |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2054 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2055 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2056 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2057 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2058 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2059 <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
|
2060 <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
|
2061 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2062 Exports a key: takes a key as a <literal>CryptoKey</literal> object |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2063 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
|
2064 (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
|
2065 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
|
2066 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
|
2067 containing the key. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2068 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
|
2069 <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
|
2070 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2071 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2072 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2073 <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
|
2074 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2075 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
|
2076 can be the following: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2077 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2078 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2079 <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
|
2080 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2081 the raw data format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2082 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2083 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2084 <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
|
2085 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2086 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2087 <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
|
2088 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2089 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2090 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2091 <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
|
2092 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2093 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2094 <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
|
2095 format |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2096 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2097 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2098 <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
|
2099 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2100 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2101 <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
|
2102 (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
|
2103 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2104 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2105 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2106 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2107 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2108 <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
|
2109 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2110 the <literal>CryptoKey</literal> that contains the key to be exported |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2111 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2112 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2113 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2114 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2115 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2116 <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
|
2117 <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
|
2118 <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
|
2119 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2120 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
|
2121 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
|
2122 (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
|
2123 Returns a <literal>Promise</literal> that fulfills with the generated key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2124 as a <literal>CryptoKey</literal> or <literal>CryptoKeyPair</literal> object. |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2125 Possible values: |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2126 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2127 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2128 <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
|
2129 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2130 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
|
2131 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
|
2132 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2133 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2134 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2135 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2136 <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
|
2137 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2138 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2139 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
|
2140 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2141 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2142 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2143 <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
|
2144 <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
|
2145 <literal>RSA-PSS</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2146 <literal>RSA-OAEP</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2147 depending on the used algorithm |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2148 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2149 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2150 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2151 <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
|
2152 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
|
2153 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2154 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2155 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2156 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2157 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2158 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2159 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2160 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2161 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2162 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2163 <literal>ECDSA</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2164 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
|
2165 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2166 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2167 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2168 <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
|
2169 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2170 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2171 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2172 <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
|
2173 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
|
2174 <literal>P-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2175 <literal>P-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2176 <literal>P-521</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2177 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2178 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2179 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2180 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2181 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2182 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2183 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2184 <literal>HMAC</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2185 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
|
2186 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2187 <list type="bullet"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2188 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2189 <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
|
2190 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2191 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2192 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2193 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2194 <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
|
2195 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
|
2196 <literal>SHA-256</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2197 <literal>SHA-384</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2198 <literal>SHA-512</literal> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2199 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2200 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2201 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2202 <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
|
2203 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
|
2204 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
|
2205 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
|
2206 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2207 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2208 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2209 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2210 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2211 <listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2212 for |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2213 <literal>AES-CTR</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2214 <literal>AES-CBC</literal>, or |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2215 <literal>AES-GCM</literal>, |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2216 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
|
2217 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
|
2218 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
|
2219 </listitem> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2220 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2221 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2222 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2223 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2224 <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
|
2225 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2226 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
|
2227 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2228 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2229 <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
|
2230 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2231 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
|
2232 <list type="tag"> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2233 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2234 <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
|
2235 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2236 key for encrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2237 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2238 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2239 <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
|
2240 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2241 key for decrypting messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2242 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2243 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2244 <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
|
2245 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2246 key for signing messages |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2247 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2248 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2249 <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
|
2250 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2251 key for verifying signatures |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2252 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2253 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2254 <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
|
2255 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2256 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
|
2257 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2258 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2259 <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
|
2260 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2261 key for deriving bits |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2262 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2263 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2264 <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
|
2265 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2266 key for wrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2267 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2268 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2269 <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
|
2270 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2271 key for unwrapping a key |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2272 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2273 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2274 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2275 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2276 </list> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2277 |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2278 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2279 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2280 <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
|
2281 <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
|
2282 <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
|
2283 <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
|
2284 <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
|
2285 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2286 Imports a key: takes as input a key in an external, portable format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2287 and gives a <literal>CryptoKey</literal> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2288 Returns a <literal>Promise</literal> that fulfills with the imported key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2289 as a <literal>CryptoKey</literal> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2290 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2291 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2292 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2293 <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
|
2294 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2295 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
|
2296 can be the following: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2297 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2298 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2299 <tag-name><literal>raw</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2300 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2301 the raw data format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2302 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2303 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2304 <tag-name><literal>pkcs8</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2305 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2306 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2307 <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
|
2308 format |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2309 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2310 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2311 <tag-name><literal>spki</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2312 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2313 the |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2314 <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
|
2315 format |
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 |
2932
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2318 <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
|
2319 <tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2320 the |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2321 <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
|
2322 (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
|
2323 </tag-desc> |
16613b91c584
Extended support for symmetric/assymetric keys in WebCrypto njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2926
diff
changeset
|
2324 |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2325 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2326 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2327 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2328 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2329 <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
|
2330 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2331 the |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2332 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2333 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2334 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2335 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
|
2336 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2337 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2338 <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
|
2339 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2340 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
|
2341 and provides extra algorithm-specific parameters: |
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 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2344 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2345 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2346 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2347 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2348 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2349 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2350 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2351 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2352 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2353 <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
|
2354 <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2355 <literal>RSA-PSS</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2356 <literal>RSA-OAEP</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2357 depending on the used algorithm |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2358 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2359 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2360 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2361 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2362 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
|
2363 <literal>SHA-1</literal>, |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2364 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2365 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2366 <literal>SHA-512</literal> |
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 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2369 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2370 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2371 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2372 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2373 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2374 <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2375 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2376 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2377 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2378 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2379 <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
|
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> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2383 <literal>namedCurve</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2384 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
|
2385 <literal>P-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2386 <literal>P-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2387 <literal>P-521</literal> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2390 </list> |
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 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2395 <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2396 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2397 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2398 <list type="bullet"> |
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 <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
|
2401 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2402 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2403 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2404 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2405 <literal>hash</literal> is a string that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2406 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
|
2407 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2408 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2409 <literal>SHA-512</literal> |
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>length</literal> (optional) is a number that represents |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2414 the length in bits of the key. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2415 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
|
2416 generated by the chosen digest function. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2417 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2418 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2419 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2420 </listitem> |
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 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2423 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2424 <literal>AES-CTR</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2425 <literal>AES-CBC</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2426 <literal>AES-GCM</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2427 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
|
2428 of the form <literal>{ "name": "ALGORITHM" }</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2429 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
|
2430 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2431 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2432 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2433 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2434 <literal>PBKDF2</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2435 pass the <literal>PBKDF2</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2436 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2437 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2438 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2439 for |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2440 <literal>HKDF</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2441 pass the <literal>HKDF</literal> string |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2442 </listitem> |
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 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2445 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2446 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2447 <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
|
2448 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2449 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
|
2450 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2451 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2452 <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
|
2453 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2454 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
|
2455 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2456 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2457 <tag-name><literal>encrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2458 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2459 key for encrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2460 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2461 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2462 <tag-name><literal>decrypt</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2463 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2464 key for decrypting messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2465 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2466 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2467 <tag-name><literal>sign</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2468 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2469 key for signing messages |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2470 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2471 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2472 <tag-name><literal>verify</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2473 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2474 key for verifying signatures |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2475 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2476 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2477 <tag-name><literal>deriveKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2478 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2479 key for deriving a new key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2480 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2481 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2482 <tag-name><literal>deriveBits</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2483 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2484 key for deriving bits |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2485 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2486 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2487 <tag-name><literal>wrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2488 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2489 key for wrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2490 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2491 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2492 <tag-name><literal>unwrapKey</literal></tag-name> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2493 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2494 key for unwrapping a key |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2495 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2496 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2497 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2498 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2499 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2500 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2501 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2502 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2503 <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
|
2504 <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
|
2505 <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
|
2506 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2507 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
|
2508 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
|
2509 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2510 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2511 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2512 <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
|
2513 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2514 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
|
2515 and its parameters: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2516 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2517 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2518 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2519 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2520 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2521 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
|
2522 of the form <literal>{ "name": "ALGORITHM" }</literal> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2525 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2526 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2527 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2528 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2529 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2530 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2531 <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
|
2532 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2533 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2534 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2535 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2536 <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
|
2537 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
|
2538 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2539 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2540 </list> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2543 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2544 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2545 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2546 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2547 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2548 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2549 <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
|
2550 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2551 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2552 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2553 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2554 <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
|
2555 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2556 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2557 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2558 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2559 </listitem> |
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> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2564 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2565 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2566 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
|
2567 of the form <literal>{ "name": "ALGORITHM" }</literal> |
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 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2570 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2571 </tag-desc> |
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 <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
|
2574 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2575 is a <literal>CryptoKey</literal> object that the key to be used for signing. |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2576 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
|
2577 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2578 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2579 <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
|
2580 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2581 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2582 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2583 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2584 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2585 object that contains the data to be signed |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2586 </tag-desc> |
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 </tag-desc> |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2592 <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
|
2593 <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
|
2594 <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
|
2595 <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
|
2596 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2597 Verifies a digital signature, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2598 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
|
2599 <literal>true</literal> if the signature is valid, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2600 otherwise <literal>false</literal>. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2601 Possible values: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2602 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2603 <list type="tag"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2604 <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
|
2605 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2606 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
|
2607 and its parameters: |
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 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2610 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2611 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2612 for <literal>RSASSA-PKCS1-v1_5</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2613 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
|
2614 of the form <literal>{ "name": "ALGORITHM" }</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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2617 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2618 for <literal>RSA-PSS</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2619 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2620 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2621 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2622 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2623 <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
|
2624 <literal>RSA-PSS</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2625 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2626 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2627 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2628 <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
|
2629 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
|
2630 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2631 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2632 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2633 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2634 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2635 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2636 for <literal>ECDSA</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2637 pass the object with the following keys: |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2638 <list type="bullet"> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2639 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2640 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2641 <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
|
2642 <literal>ECDSA</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2643 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2644 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2645 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2646 <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
|
2647 can be |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2648 <literal>SHA-256</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2649 <literal>SHA-384</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2650 <literal>SHA-512</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2651 </listitem> |
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 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2654 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2655 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2656 <listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2657 for <literal>HMAC</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2658 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
|
2659 of the form <literal>{ "name": "ALGORITHM" }</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2660 </listitem> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2661 </list> |
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-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2664 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2665 <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
|
2666 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2667 is a <literal>CryptoKey</literal> object that the key to be used for verifying. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2668 It is the secret key for a symmetric algorithm |
2792
c6713b6b86ce
Removed trailing spaces.
Maxim Dounin <mdounin@mdounin.ru>
parents:
2783
diff
changeset
|
2669 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
|
2670 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2671 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2672 <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
|
2673 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2674 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2675 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2676 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2677 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2678 that contains the signature to verify |
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 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2681 <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
|
2682 <tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2683 is an |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2684 <literal>ArrayBuffer</literal>, |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2685 <literal>TypedArray</literal>, or |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2686 <literal>DataView</literal> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2687 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
|
2688 </tag-desc> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2689 </list> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2690 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2691 </tag-desc> |
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> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2694 </para> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2695 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2696 </section> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2697 |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
2698 |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2699 <section id="njs" name="njs"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2700 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2701 <para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2702 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
|
2703 that represents the current VM instance |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2704 (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
|
2705 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2706 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2707 <para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2708 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2709 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2710 <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
|
2711 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2712 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
|
2713 (for example, “0.7.4”). |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
2714 </tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
2715 |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
2716 <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
|
2717 <tag-desc> |
f5e49925e9db
Documented the njs.version_number property in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2840
diff
changeset
|
2718 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
|
2719 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
|
2720 (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
|
2721 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2722 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2723 <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
|
2724 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2725 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
|
2726 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2727 |
2904
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2728 <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
|
2729 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2730 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
|
2731 (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
|
2732 <list type="tag"> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2733 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2734 <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
|
2735 <tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2736 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
|
2737 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2738 |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2739 </list> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2740 </tag-desc> |
4aaab86a9c26
Added the njs.memoryStats property in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2902
diff
changeset
|
2741 |
2679
8f3e9ff2785f
Corrected syntax of njs.on() and ngx.fetch() in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2670
diff
changeset
|
2742 <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
|
2743 <value>callback</value>)</literal></tag-name> |
2666
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2744 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2745 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
|
2746 (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
|
2747 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
|
2748 <list type="tag"> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2749 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2750 <tag-name><literal>exit</literal></tag-name> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2751 <tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2752 is called before the VM is destroyed. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2753 The callback is called without arguments. |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2754 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2755 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2756 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2757 </tag-desc> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2758 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2759 </list> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2760 </para> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2761 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2762 </section> |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2763 |
68c0566a375f
Documented njs global object in njs Refernce.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2665
diff
changeset
|
2764 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2765 <section id="process" name="process"> |
2405
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2766 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2767 <para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2768 The <literal>process</literal> object is a global object |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2769 that provides information about the current process |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2770 (<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
|
2771 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2772 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2773 <para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2774 <list type="tag"> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2775 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2776 <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
|
2777 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2778 Returns an array that contains the command line arguments |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2779 passed when the current process was launched. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2780 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2781 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2782 <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
|
2783 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2784 Returns an object containing the user environment. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2785 <note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2786 By default, nginx removes all environment variables inherited |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2787 from its parent process except the TZ variable. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2788 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
|
2789 to preserve some of the inherited variables. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2790 </note> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2791 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2792 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2793 <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
|
2794 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2795 Returns the PID of the current process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2796 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2797 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2798 <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
|
2799 <tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2800 Returns the PID of the current parent process. |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2801 </tag-desc> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2802 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2803 </list> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2804 </para> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2805 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2806 </section> |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2807 |
dbf68c949522
Documented the "process" global object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2394
diff
changeset
|
2808 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2809 <section id="string" name="String"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2810 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2811 <para> |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2812 There are two types of strings in njs: a Unicode string (default) and |
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2813 a byte string. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2814 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2815 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2816 <para> |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2817 A Unicode string corresponds to an ECMAScript string |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2818 which contains Unicode characters. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2819 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2820 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2821 <para> |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2822 Byte strings contain a sequence of bytes |
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2823 and are used to serialize Unicode strings |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2824 to external data and deserialize from external sources. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2825 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
|
2826 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
|
2827 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2828 >> '£'.toUTF8().toString('hex') |
2688
dd2bbd104146
Unified spelling of UTF-8 in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2687
diff
changeset
|
2829 '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
|
2830 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2831 The <link id="string_tobytes">toBytes()</link> method serializes |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2832 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
|
2833 otherwise, <literal>null</literal> is returned: |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2834 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2835 >> '£'.toBytes().toString('hex') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
2836 '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
|
2837 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2838 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2839 <list type="tag"> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2840 |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2841 <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
|
2842 | <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
|
2843 <tag-desc> |
2569
2edc64c05b0e
Removed ECMAScript methods from njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2564
diff
changeset
|
2844 Creates a byte string either from an array that contains octets, |
2315
ae56e4613280
Corrected language in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2313
diff
changeset
|
2845 or from an encoded string |
2337
867fe207f13e
Updated links to changes.xml in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2332
diff
changeset
|
2846 (<link doc="changes.xml" id="njs0.2.3">0.2.3</link>). |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2847 The encoding can be |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2848 <literal>hex</literal>, |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2849 <literal>base64</literal>, and |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2850 <literal>base64url</literal>. |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
2851 The method is deprecated since |
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
2852 <link doc="changes.xml" id="njs0.4.4">0.4.4</link>, |
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
2853 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
|
2854 <example> |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
2855 >> 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
|
2856 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2857 |
2605
0ec1e1b063d7
Deprecated String.bytesFrom method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2604
diff
changeset
|
2858 >> Buffer.from('YnVmZmVy', 'base64').toString() |
2211
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2859 'buffer' |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2860 </example> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2861 </tag-desc> |
660229c5c92f
Documented String.bytesFrom() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2207
diff
changeset
|
2862 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
2863 <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
|
2864 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2865 <tag-desc> |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2866 the property is deprecated since |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2867 <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
|
2868 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
|
2869 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
|
2870 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
|
2871 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2872 |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
2873 <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
|
2874 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2875 <tag-desc> |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2876 the property is deprecated since |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2877 <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
|
2878 the <link id="textedeoder"><literal>TextDecoder</literal></link> method |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2879 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2880 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
|
2881 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
|
2882 into a Unicode string, |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2883 otherwise <literal>null</literal> was returned. |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2884 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2885 |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
2886 <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
|
2887 <value>end</value>])</literal></tag-name> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2888 <tag-desc> |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2889 the property is deprecated since |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2890 <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
|
2891 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
|
2892 serialized a Unicode string to a byte string, |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2893 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
|
2894 found in the string. |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2895 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2896 |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2897 <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
|
2898 <tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2899 <para> |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2900 the property is deprecated since |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2901 <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
|
2902 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
|
2903 encoded a string to |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2904 <literal>hex</literal>, |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2905 <literal>base64</literal>, or |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2906 <literal>base64url</literal>: |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2907 <example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2908 >> 'αβγδ'.toString('base64url') |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2909 'zrHOss6zzrQ' |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2910 </example> |
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2911 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
|
2912 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
|
2913 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2914 >> 'αβγδ'.toUTF8().toString('base64url') |
2214
e029f4bc7ede
Added quotes to njs examples.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2212
diff
changeset
|
2915 'zrHOss6zzrQ' |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2916 </example> |
2582
e162a71453b0
Improved String.prototype.toString() for ordinary strings in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2579
diff
changeset
|
2917 </para> |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2918 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2919 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2920 <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
|
2921 <value>end</value>])</literal></tag-name> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2922 <tag-desc> |
2884
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2923 the property is deprecated since |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2924 <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
|
2925 the <link id="textencoder"><literal>TextEncoder</literal></link> method |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2926 should be used instead. |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2927 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
|
2928 serialized a Unicode string |
ccd42f2b99fb
Deprecated several methods in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2881
diff
changeset
|
2929 to a byte string using UTF-8 encoding: |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2930 <example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2931 >> 'αβγδ'.toUTF8().length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2932 8 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2933 >> 'αβγδ'.length |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2934 4 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2935 </example> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2936 </tag-desc> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2937 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2938 </list> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2939 </para> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2940 |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2941 </section> |
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2942 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2943 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2944 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2945 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2946 <section id="webapi" name="web API"> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
2947 |
2186
8e2b3aadc3ce
Added njs String object.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2183
diff
changeset
|
2948 |
2585
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2949 <section id="textdecoder" name="Text Decoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2950 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2951 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2952 The <literal>TextDecoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2953 produces a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2954 from a stream of bytes |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2955 (<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
|
2956 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2957 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2958 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2959 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2960 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2961 <tag-name><literal>TextDecoder([[<value>encoding</value>], |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2962 <value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2963 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2964 Creates a new <literal>TextDecoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2965 for specified <literal>encoding</literal>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2966 currently, only UTF-8 is supported. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2967 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2968 <literal>TextDecoderOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2969 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2970 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2971 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2972 <tag-name><literal>fatal</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2973 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2974 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2975 <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
|
2976 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
|
2977 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
|
2978 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2979 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2980 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2981 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2982 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2983 <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
|
2984 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2985 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
|
2986 <link id="textdecoder"><literal>TextDecoder()</literal></link>, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2987 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2988 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2989 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2990 <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
|
2991 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2992 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2993 the error mode is fatal, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2994 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2995 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2996 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2997 <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
|
2998 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
2999 boolean flag, <literal>true</literal> if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3000 the byte order marker is ignored, |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3001 read-only. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3002 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3003 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3004 <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
|
3005 [<value>options</value>])</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3006 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3007 Returns a string with the text |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3008 decoded from the <literal>buffer</literal> by |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3009 <link id="textdecoder"><literal>TextDecoder()</literal></link>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3010 The buffer can be <literal>ArrayBuffer</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3011 The <literal>options</literal> is |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3012 <literal>TextDecodeOptions</literal> dictionary with the property: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3013 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3014 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3015 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3016 <tag-name><literal>stream</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3017 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3018 boolean flag indicating if |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3019 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
|
3020 <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
|
3021 <literal>false</literal> for the final chunk |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3022 or if the data is not chunked. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3023 By default is <literal>false</literal>. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3024 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3025 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3026 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3027 <example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3028 >> (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
|
3029 αβ |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3030 </example> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3031 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3032 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3033 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3034 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3035 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3036 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3037 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3038 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3039 <section id="textencoder" name="Text Encoder"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3040 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3041 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3042 The <literal>TextEncoder</literal> object |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3043 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
|
3044 from a stream of code points |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3045 (<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
|
3046 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3047 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3048 <para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3049 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3050 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3051 <tag-name><literal>TextEncoder()</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3052 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3053 Returns a newly constructed <literal>TextEncoder</literal> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3054 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
|
3055 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3056 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3057 <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
|
3058 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3059 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
|
3060 with UTF-8 encoded text. |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3061 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3062 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3063 <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
|
3064 <value>uint8Array</value>)</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3065 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3066 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
|
3067 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
|
3068 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
|
3069 The dictionary object contains two members: |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3070 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3071 <list type="tag"> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3072 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3073 <tag-name><literal>read</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3074 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3075 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
|
3076 converted to UTF-8 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3077 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3078 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3079 <tag-name><literal>written</literal></tag-name> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3080 <tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3081 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
|
3082 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3083 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3084 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3085 </tag-desc> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3086 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3087 </list> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3088 </para> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3089 |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3090 </section> |
7035221dbe37
Documented TextDecoder and TextEncoder in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2583
diff
changeset
|
3091 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3092 </section> |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3093 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3094 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3095 <section id="njs_api_timers" name="timers"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3096 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3097 <para> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3098 <list type="tag"> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3099 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3100 <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
|
3101 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3102 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
|
3103 created by <link id="settimeout"><literal>setTimeout()</literal></link>. |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3104 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3105 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3106 <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
|
3107 <value>milliseconds</value>[, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3108 <value>argument1</value>, |
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3109 <value>argumentN</value>])</literal></tag-name> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3110 <tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3111 Calls a <literal>function</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3112 after a specified number of <literal>milliseconds</literal>. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3113 One or more optional <literal>arguments</literal> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3114 can be passed to the specified function. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3115 Returns a <literal>timeout</literal> object. |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3116 <example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3117 function handler(v) |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3118 { |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3119 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3120 } |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3121 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3122 t = setTimeout(handler, 12); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3123 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3124 // ... |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3125 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3126 clearTimeout(t); |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3127 </example> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3128 </tag-desc> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3129 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3130 </list> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3131 </para> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3132 |
2873
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3133 <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
|
3134 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3135 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3136 <list type="tag"> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3137 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3138 <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
|
3139 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3140 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
|
3141 using <literal>Base64</literal> encoding. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3142 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
|
3143 that contains Base64-encoded data. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3144 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
|
3145 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3146 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
|
3147 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
|
3148 which may otherwise cause communication problems, |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3149 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
|
3150 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3151 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
|
3152 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
|
3153 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3154 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
|
3155 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
|
3156 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3157 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3158 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3159 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3160 <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
|
3161 <tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3162 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
|
3163 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
|
3164 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
|
3165 <literal>stringToEncode</literal>. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3166 <para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3167 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
|
3168 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
|
3169 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
|
3170 to decode the data again. |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3171 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
|
3172 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
|
3173 <example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3174 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
|
3175 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
|
3176 </example> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3177 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3178 </tag-desc> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3179 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3180 </list> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3181 </para> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3182 |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3183 </section> |
b4eb565bbb1f
Documented atob and btoa global functions in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2872
diff
changeset
|
3184 |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3185 </section> |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3186 |
2687
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3187 |
7ff9d8bda757
Revised TOC in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2685
diff
changeset
|
3188 <section id="builtin_modules" name="built-in modules"> |
2578
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3189 |
fafb7767c128
Restructured njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2571
diff
changeset
|
3190 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3191 <section id="buffer" name="Buffer"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3192 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3193 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3194 <list type="tag"> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3195 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3196 <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
|
3197 <value>fill</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3198 <value>encoding</value>]]))</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3199 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3200 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3201 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
|
3202 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
|
3203 If <value>fill</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3204 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3205 <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
|
3206 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
|
3207 the allocated Buffer will be initialized by calling |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3208 <link id="buf_fill"><literal>buf.fill(fill, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3209 encoding)</literal></link>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3210 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3211 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3212 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3213 The <value>fill</value> parameter may be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3214 <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3215 <value>Buffer</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3216 <value>Uint8Array</value>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3217 <value>integer</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3218 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3219 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3220 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3221 <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
|
3222 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3223 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3224 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3225 <link id="buffer_alloc"><literal>Buffer.alloc()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3226 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
|
3227 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
|
3228 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3229 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3230 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3231 <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
|
3232 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3233 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3234 Returns the byte length of a specified value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3235 when encoded using <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3236 The value can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3237 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3238 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3239 <literal>TypedArray</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3240 <literal>DataView</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3241 <literal>ArrayBuffer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3242 If the value is a <value>string</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3243 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
|
3244 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3245 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3246 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3247 <value>base64url</value>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3248 by default is <value>utf8</value>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3249 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3250 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3251 <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
|
3252 <value>buffer2</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3253 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3254 Compares <value>buffer1</value> with <value>buffer2</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3255 when sorting arrays of Buffer instances. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3256 Returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3257 <literal>0</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3258 <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
|
3259 <literal>1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3260 <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
|
3261 <literal>-1</literal> if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3262 <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
|
3263 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3264 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3265 <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
|
3266 <value>totalLength</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3267 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3268 Returns a new Buffer |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3269 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
|
3270 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
|
3271 a new zero-length Buffer is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3272 If <value>totalLength</value> is not specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3273 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
|
3274 If <value>totalLength</value> is specified, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3275 it is coerced to an unsigned integer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3276 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
|
3277 <value>totalLength</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3278 the result is truncated to <value>totalLength</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3279 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3280 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3281 <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
|
3282 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3283 Allocates a new Buffer using an array of bytes |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3284 in the range <literal>0</literal> – <literal>255</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3285 Array entries outside that range will be truncated. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3286 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3287 |
2612
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3288 <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
|
3289 <value>byteOffset</value>[, |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3290 <value>length</value>]])</literal></tag-name> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3291 <tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3292 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
|
3293 without copying the underlying memory. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3294 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
|
3295 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
|
3296 that will be shared by the Buffer. |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3297 </tag-desc> |
6fdefb00858f
Documented Buffer.from(arrayBuffer) method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2609
diff
changeset
|
3298 |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3299 <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
|
3300 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3301 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
|
3302 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3303 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3304 <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
|
3305 <value>offsetOrEncoding</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3306 <value>length</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3307 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3308 For objects whose <literal>valueOf()</literal> function |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3309 returns a value not strictly equal to object, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3310 returns |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3311 <literal>Buffer.from(object.valueOf()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3312 <literal>offsetOrEncoding</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3313 <literal>length</literal>). |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3314 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3315 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3316 <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
|
3317 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3318 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3319 Creates a new Buffer with a <value>string</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3320 The <value>encoding</value> parameter identifies the character encoding |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3321 to be used when converting a string into bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3322 The encoding can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3323 <literal>utf8</literal>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3324 <literal>hex</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3325 <literal>base64</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3326 <literal>base64url</literal>; |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3327 by default is <literal>utf8</literal>. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3328 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3329 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3330 <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
|
3331 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3332 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3333 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
|
3334 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3335 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3336 <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
|
3337 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3338 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3339 returns <literal>true</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3340 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
|
3341 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3342 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3343 <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
|
3344 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3345 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
|
3346 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
|
3347 The values refer to individual bytes, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3348 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
|
3349 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3350 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3351 <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
|
3352 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3353 The underlying <literal>ArrayBuffer</literal> object |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3354 based on which this Buffer object is created. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3355 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3356 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3357 <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
|
3358 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3359 An integer, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3360 specifying the <literal>byteOffset</literal> of the Buffers |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3361 underlying <literal>ArrayBuffer</literal> object. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3362 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3363 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3364 <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
|
3365 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3366 <value>targetEnd</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3367 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3368 <value>sourceEnd</value>]]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3369 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3370 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
|
3371 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
|
3372 as <value>target</value> in sort order. |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3373 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
|
3374 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3375 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
|
3376 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3377 The <literal>targetEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3378 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
|
3379 by default is <literal>target.length</literal>. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3380 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3381 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
|
3382 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3383 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3384 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
|
3385 by default is <literal>buf.length</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3386 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3387 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3388 <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
|
3389 <value>targetStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3390 <value>sourceStart</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3391 <value>sourceEnd</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3392 <tag-desc> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3393 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
|
3394 even if the target memory region overlaps with buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3395 The <literal>target</literal> parameter is a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3396 <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
|
3397 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3398 <para> |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3399 The <literal>targetStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3400 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
|
3401 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3402 The <literal>sourceStart</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3403 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
|
3404 by default is 0. |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3405 The <literal>sourceEnd</literal> is an integer specifying |
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3406 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
|
3407 by default is <value>buf.length</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3408 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3409 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3410 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3411 <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
|
3412 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3413 A boolean value, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3414 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
|
3415 have exactly the same bytes. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3416 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3417 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3418 <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
|
3419 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3420 <value>end</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3421 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3422 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3423 Fills the Buffer with the specified <value>value</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3424 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
|
3425 the entire Buffer will be filled. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3426 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
|
3427 <literal>string</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3428 <literal>Buffer</literal>, or |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3429 <literal>integer</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3430 If the resulting integer is greater than 255, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3431 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
|
3432 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3433 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3434 <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
|
3435 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3436 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3437 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3438 Equivalent to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3439 <link id="buf_indexof"><literal>buf.indexOf()</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3440 <literal>!== -1</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3441 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
|
3442 in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3443 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3444 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3445 <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
|
3446 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3447 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3448 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3449 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
|
3450 <value>value</value> in Buffer, or <value>-1</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3451 if Buffer does not contain value. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3452 The <value>value</value> can be a |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3453 <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
|
3454 (by default <value>utf8</value>), |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3455 <literal>Buffer</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3456 <literal>Unit8Array</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3457 or a number between 0 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3458 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3459 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3460 <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
|
3461 <value>byteOffset</value>][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3462 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3463 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3464 The same as |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3465 <link id="buf_indexof"><literal>buf.indexOf()</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3466 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
|
3467 instead of the first occurrence. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3468 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
|
3469 integer between 1 and 255. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3470 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
|
3471 <literal>byteOffset</literal> will be returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3472 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3473 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3474 <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
|
3475 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3476 Returns the number of bytes in Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3477 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3478 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3479 <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
|
3480 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3481 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3482 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3483 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3484 and interprets the result as a big-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3485 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
|
3486 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
|
3487 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3488 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3489 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3490 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3491 <literal>buf.readInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3492 <literal>buf.readInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3493 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3494 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3495 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3496 <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
|
3497 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3498 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3499 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3500 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3501 and interprets the result as a little-endian, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3502 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
|
3503 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
|
3504 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3505 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3506 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3507 <literal>buf.readInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3508 <literal>buf.readInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3509 <literal>buf.readInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3510 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3511 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3512 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3513 <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
|
3514 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3515 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3516 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3517 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3518 and interprets the result as a big-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3519 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3520 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
|
3521 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3522 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3523 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3524 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3525 <literal>buf.readUInt16BE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3526 <literal>buf.readUInt32BE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3527 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3528 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3529 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3530 <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
|
3531 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3532 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3533 Reads the <value>byteLength</value> from <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3534 at the specified <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3535 and interprets the result as a little-endian |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3536 integer supporting up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3537 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
|
3538 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3539 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3540 The similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3541 <literal>buf.readUInt8([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3542 <literal>buf.readUInt16LE([offset])</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3543 <literal>buf.readUInt32LE([offset])</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3544 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3545 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3546 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3547 <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
|
3548 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3549 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
|
3550 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3551 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3552 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3553 <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
|
3554 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3555 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
|
3556 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3557 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3558 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3559 <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
|
3560 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3561 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
|
3562 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3563 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3564 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3565 <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
|
3566 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3567 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
|
3568 at the specified <value>offset</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3569 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3570 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3571 <tag-name id="buf_subarray"><literal>buf.subarray[<value>start</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3572 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3573 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3574 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3575 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3576 but offset and cropped by |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3577 <value>start</value> and <value>end</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3578 If <value>end</value> is greater than |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3579 <link id="buf_length"><literal>buf.length</literal></link>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3580 the same result as that of end equal to |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3581 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3582 is returned. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3583 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3584 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3585 <tag-name id="buf_slice"><literal>buf.slice[<value>start</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3586 <value>end</value>]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3587 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3588 Returns a new <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3589 that references the same memory as the original, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3590 but offset and cropped by the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3591 <value>start</value> and <value>end</value> values. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3592 The method is not compatible with the |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3593 <literal>Uint8Array.prototype.slice()</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3594 which is a superclass of Buffer. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3595 To copy the slice, use |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3596 <literal>Uint8Array.prototype.slice()</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3597 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3598 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3599 <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
|
3600 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3601 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
|
3602 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3603 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3604 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3605 is not a multiple of 2. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3606 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3607 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3608 <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
|
3609 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3610 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
|
3611 and swaps the byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3612 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3613 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3614 is not a multiple of 4. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3615 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3616 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3617 <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
|
3618 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3619 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
|
3620 and swaps byte order in-place. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3621 Throws an error if |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3622 <link id="buf_length"><literal>buf.length</literal></link> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3623 is not a multiple of 8. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3624 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3625 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3626 <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
|
3627 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3628 Returns a JSON representation of <literal>buf.</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3629 <literal>JSON.stringify()</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3630 implicitly calls this function when stringifying a Buffer instance. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3631 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3632 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3633 <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
|
3634 <value>start</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3635 <value>end</value>]]])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3636 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3637 Decodes <literal>buf</literal> to a string |
2647
0085d9f7dc3f
Minor corrections in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2631
diff
changeset
|
3638 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
|
3639 which can be <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3640 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3641 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3642 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3643 The <value>start</value> and <value>end</value> parameters |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3644 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
|
3645 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3646 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3647 <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
|
3648 <value>offset</value>[, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3649 <value>length</value>]][, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3650 <value>encoding</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3651 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3652 Writes a <value>string</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3653 at <value>offset</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3654 according to the character <value>encoding</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3655 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
|
3656 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
|
3657 only part of string will be written, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3658 however, partially encoded characters will not be written. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3659 The <value>encoding</value> can be |
2631
7da360f50017
Unified spelling of "utf-8" in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2630
diff
changeset
|
3660 <value>utf8</value>, |
2609
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3661 <value>hex</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3662 <value>base64</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3663 <value>base64url</value>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3664 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3665 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3666 <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
|
3667 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3668 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3669 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3670 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3671 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3672 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3673 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3674 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
|
3675 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3676 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3677 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3678 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3679 <literal>buf.writeInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3680 <literal>buf.writeInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3681 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3682 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3683 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3684 <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
|
3685 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3686 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3687 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3688 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3689 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3690 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3691 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3692 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
|
3693 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3694 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3695 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3696 <literal>buf.writeInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3697 <literal>buf.writeInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3698 <literal>buf.writeInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3699 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3700 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3701 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3702 <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
|
3703 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3704 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3705 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3706 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3707 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3708 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3709 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3710 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
|
3711 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3712 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3713 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3714 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3715 <literal>buf.writeUInt16BE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3716 <literal>buf.writeUInt32BE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3717 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3718 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3719 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3720 <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
|
3721 <value>offset</value>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3722 <value>byteLength</value>)</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3723 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3724 Writes <value>byteLength</value> bytes of <value>value</value> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3725 to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3726 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3727 Supports up to 48 bits of accuracy. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3728 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
|
3729 specifying the number of bytes to read. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3730 <para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3731 The following similar methods are also supported: |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3732 <literal>buf.writeUInt8</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3733 <literal>buf.writeUInt16LE</literal>, |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3734 <literal>buf.writeUInt32LE</literal>. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3735 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3736 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3737 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3738 <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
|
3739 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3740 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3741 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3742 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3743 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3744 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3745 <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
|
3746 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3747 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3748 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3749 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3750 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3751 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3752 <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
|
3753 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3754 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3755 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3756 at the specified <value>offset</value> as big-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3757 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3758 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3759 <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
|
3760 [<value>offset</value>])</literal></tag-name> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3761 <tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3762 Writes the <value>value</value> to <literal>buf</literal> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3763 at the specified <value>offset</value> as little-endian. |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3764 </tag-desc> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3765 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3766 </list> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3767 </para> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3768 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3769 </section> |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3770 |
99bd2ae8d2be
Added Buffer to njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2605
diff
changeset
|
3771 |
2177 | 3772 <section id="crypto" name="Crypto"> |
3773 | |
3774 <para> | |
2783
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3775 <note> |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3776 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
|
3777 extended crypto API is available as a global |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3778 <link id="builtin_crypto">crypto</link> object. |
87713cb4be56
Documented WebCrypto API for njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2777
diff
changeset
|
3779 </note> |
2177 | 3780 The Crypto module provides cryptographic functionality support. |
3781 The Crypto module object is returned by <literal>require('crypto')</literal>. | |
3782 </para> | |
3783 | |
3784 <para> | |
3785 <list type="tag"> | |
3786 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3787 <tag-name id="crypto_createhash"><literal>crypto.createHash(<value>algorithm</value>)</literal></tag-name> |
2177 | 3788 <tag-desc> |
3789 Creates and returns a <link id="crypto_hash">Hash</link> object | |
3790 that can be used to generate hash digests | |
3791 using the given <value>algorithm</value>. | |
2496
9dddac1420fe
Fixed typo in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2484
diff
changeset
|
3792 The algorithm can be |
2177 | 3793 <literal>md5</literal>, |
3794 <literal>sha1</literal>, and | |
3795 <literal>sha256</literal>. | |
3796 </tag-desc> | |
3797 | |
2267
c30048802769
Added links to njs reference from njs Compatibility.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2259
diff
changeset
|
3798 <tag-name id="crypto_createhmac"><literal>crypto.createHmac(<value>algorithm</value>, |
2177 | 3799 <value>secret key</value>)</literal></tag-name> |
3800 <tag-desc> | |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
3801 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
|
3802 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
|
3803 The algorithm can be |
2177 | 3804 <literal>md5</literal>, |
3805 <literal>sha1</literal>, and | |
3806 <literal>sha256</literal>. | |
3807 </tag-desc> | |
3808 | |
3809 </list> | |
3810 </para> | |
3811 | |
3812 | |
3813 <section id="crypto_hash" name="Hash"> | |
3814 | |
3815 <para> | |
3816 <list type="tag"> | |
3817 | |
2601 | 3818 <tag-name id="crypto_hash_update"><literal>hash.update(<value>data</value>)</literal></tag-name> |
2177 | 3819 <tag-desc> |
3820 Updates the hash content with the given <value>data</value>. | |
3821 </tag-desc> | |
3822 | |
2601 | 3823 <tag-name id="crypto_hash_digest"><literal>hash.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 3824 <tag-desc> |
3825 Calculates the digest of all of the data passed using | |
3826 <literal>hash.update()</literal>. | |
3827 The encoding can be | |
3828 <literal>hex</literal>, | |
3829 <literal>base64</literal>, and | |
3830 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
3831 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
|
3832 (<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
|
3833 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
3834 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
|
3835 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
|
3836 </note> |
2177 | 3837 </tag-desc> |
3838 | |
2952
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
3839 <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
|
3840 <tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
3841 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
|
3842 (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
|
3843 </tag-desc> |
4939c98e2f25
Documented hash.copy() method in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2951
diff
changeset
|
3844 |
2177 | 3845 </list> |
3846 </para> | |
3847 | |
3848 <para> | |
3849 <example> | |
3850 >> var cr = require('crypto') | |
3851 undefined | |
3852 | |
3853 >> 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
|
3854 'BtlFlCqiamG-GMPiK_GbvKjdK10' |
2177 | 3855 </example> |
3856 </para> | |
3857 | |
3858 </section> | |
3859 | |
3860 | |
3861 <section id="crypto_hmac" name="HMAC"> | |
3862 | |
3863 <para> | |
3864 <list type="tag"> | |
3865 | |
2601 | 3866 <tag-name id="crypto_hmac_update"><literal>hmac.update(<value>data</value>)</literal></tag-name> |
2177 | 3867 <tag-desc> |
3868 Updates the HMAC content with the given <value>data</value>. | |
3869 </tag-desc> | |
3870 | |
2601 | 3871 <tag-name id="crypto_hmac_digest"><literal>hmac.digest([<value>encoding</value>])</literal></tag-name> |
2177 | 3872 <tag-desc> |
3873 Calculates the HMAC digest of all of the data passed using | |
3874 <literal>hmac.update()</literal>. | |
3875 The encoding can be | |
3876 <literal>hex</literal>, | |
3877 <literal>base64</literal>, and | |
3878 <literal>base64url</literal>. | |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
3879 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
|
3880 (<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
|
3881 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
3882 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
|
3883 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
|
3884 </note> |
2177 | 3885 </tag-desc> |
3886 </list> | |
3887 </para> | |
3888 | |
3889 <para> | |
3890 <example> | |
3891 >> var cr = require('crypto') | |
3892 undefined | |
3893 | |
3894 >> 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
|
3895 'Oglm93xn23_MkiaEq_e9u8zk374' |
2177 | 3896 </example> |
3897 </para> | |
3898 | |
3899 </section> | |
3900 | |
3901 </section> | |
3902 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3903 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3904 <section id="njs_api_fs" name="File System"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3905 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3906 <para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3907 The File System module provides operations with files. |
2507 | 3908 </para> |
3909 | |
3910 <para> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3911 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
|
3912 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
|
3913 promissified versions of file system methods are available through |
2507 | 3914 <literal>require('fs').promises</literal> object: |
3915 <example> | |
3916 > var fs = require('fs').promises; | |
3917 undefined | |
3918 > fs.readFile("/file/path").then((data)=>console.log(data)) | |
3919 <file data> | |
3920 </example> | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3921 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3922 |
2507 | 3923 <tag-name id="fs_accesssync"><literal>accessSync(<value>path</value>[, |
3924 <value>mode</value>])</literal></tag-name> | |
3925 <tag-desc> | |
3926 Synchronously tests permissions for a file or directory | |
3927 specified in the <literal>path</literal> | |
3928 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
3929 If the check fails, an error will be returned, | |
3930 otherwise, the method will return undefined. | |
3931 <list type="tag"> | |
3932 | |
3933 <tag-name><literal>mode</literal></tag-name> | |
3934 <tag-desc> | |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3935 an optional integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3936 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
|
3937 by default is <link id="access_const"><literal>fs.constants.F_OK</literal></link> |
2507 | 3938 <example> |
3939 try { | |
3940 fs.accessSync('/file/path', fs.constants.R_OK | fs.constants.W_OK); | |
3941 console.log('has access'); | |
3942 } catch (e) { | |
3943 console.log('no access');) | |
3944 } | |
3945 </example> | |
3946 </tag-desc> | |
3947 | |
3948 </list> | |
3949 </tag-desc> | |
3950 | |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
3951 <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
|
3952 <value>data</value>[, <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3953 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3954 Synchronously appends specified <literal>data</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3955 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
|
3956 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
|
3957 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
|
3958 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
|
3959 The <literal>options</literal> parameter is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3960 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3961 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3962 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3963 <tag-name><literal>mode</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3964 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3965 mode option, by default is <literal>0o666</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3966 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3967 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3968 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3969 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3970 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
|
3971 by default is <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3972 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3973 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3974 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3975 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
3976 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3977 <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
|
3978 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3979 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
|
3980 for the file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3981 (<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
|
3982 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
|
3983 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
|
3984 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
3985 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3986 <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
|
3987 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3988 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3989 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3990 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
|
3991 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
|
3992 (<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
|
3993 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
|
3994 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3995 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3996 <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
|
3997 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3998 a boolean value which indicates |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
3999 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
|
4000 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4001 by default is <literal>false</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4002 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4003 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4004 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4005 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4006 <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
|
4007 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4008 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4009 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
|
4010 (<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
|
4011 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
|
4012 <literal>integer</literal> that specifies |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4013 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
|
4014 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
|
4015 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4016 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4017 <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
|
4018 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4019 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
|
4020 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4021 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4022 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4023 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4024 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4025 <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
|
4026 <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
|
4027 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4028 Returns an integer |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4029 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
|
4030 (<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
|
4031 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4032 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4033 <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
|
4034 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4035 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
|
4036 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
|
4037 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4038 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4039 <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
|
4040 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4041 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
|
4042 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4043 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4044 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4045 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4046 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4047 <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
|
4048 <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
|
4049 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4050 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
|
4051 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
|
4052 (<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
|
4053 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4054 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4055 <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
|
4056 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4057 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
|
4058 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
|
4059 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4060 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4061 <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
|
4062 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4063 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
|
4064 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4065 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4066 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4067 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4068 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4069 <tag-name id="fs_readsync"><literal>readSync(<value>fd</value>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4070 <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
|
4071 <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
|
4072 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4073 Reads the content of a file path using file descriptor <literal>fd</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4074 returns the number of bytes read |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4075 (<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
|
4076 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4077 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4078 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4079 <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
|
4080 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4081 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
|
4082 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4083 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4084 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4085 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4086 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4087 <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
|
4088 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4089 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
|
4090 the position in buffer to write the data to |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4091 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4092 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4093 <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
|
4094 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4095 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
|
4096 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
|
4097 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4098 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4099 <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
|
4100 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4101 specifies where to begin reading from in the file, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4102 the value can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4103 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4104 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4105 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
|
4106 If <literal>position</literal> is <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4107 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
|
4108 and the file position will be updated. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4109 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
|
4110 the file position will be unchanged |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4111 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4112 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4113 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4114 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4115 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4116 <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
|
4117 <value>options</value>])</literal></tag-name> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4118 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4119 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
|
4120 at the specified <literal>path</literal> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4121 (<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
|
4122 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
|
4123 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
|
4124 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
|
4125 <list type="tag"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4126 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4127 <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
|
4128 <tag-desc> |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4129 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
|
4130 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
|
4131 (<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
|
4132 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4133 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4134 <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
|
4135 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4136 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
|
4137 <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
|
4138 by default is <literal>false</literal>. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4139 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4140 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4141 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4142 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4143 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4144 <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
|
4145 <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4146 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4147 Synchronously returns the contents of the file |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4148 with provided <literal>filename</literal>. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4149 The <literal>options</literal> parameter holds |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4150 <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
|
4151 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
|
4152 otherwise, a Buffer object |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4153 (<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
|
4154 <note> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4155 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
|
4156 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
|
4157 if encoding was not specified. |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4158 </note> |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4159 Otherwise, <literal>options</literal> is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4160 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4161 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4162 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4163 <tag-name><literal>encoding</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4164 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4165 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
|
4166 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
|
4167 <literal>hex</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4168 (<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
|
4169 <literal>base64</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4170 (<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
|
4171 <literal>base64url</literal> |
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4172 (<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
|
4173 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4174 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4175 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4176 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4177 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
|
4178 by default is <literal>r</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4179 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4180 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4181 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4182 <example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4183 >> var fs = require('fs') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4184 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4185 >> var file = fs.readFileSync('/file/path.tar.gz') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4186 undefined |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4187 >> 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
|
4188 true |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4189 </example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4190 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4191 |
2507 | 4192 <tag-name id="fs_realpathsync"><literal>realpathSync(<value>path</value>[, |
4193 <value>options</value>])</literal></tag-name> | |
4194 <tag-desc> | |
4195 Synchronously computes the canonical pathname by resolving | |
4196 <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
|
4197 <link url="http://man7.org/linux/man-pages/man3/realpath.3.html">realpath(3)</link>. |
2507 | 4198 The <literal>options</literal> argument can be a string specifying an encoding, |
4199 or an object with an encoding property specifying the character encoding | |
4200 to use for the path passed to the callback | |
4201 (<link doc="changes.xml" id="njs0.3.9">0.3.9</link>). | |
4202 </tag-desc> | |
4203 | |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4204 <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
|
4205 <value>newPath</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4206 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4207 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
|
4208 <literal>oldPath</literal> to <literal>newPath</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4209 (<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
|
4210 <example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4211 >> var fs = require('fs') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4212 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4213 >> var file = fs.renameSync('hello.txt', 'HelloWorld.txt') |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4214 undefined |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4215 </example> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4216 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4217 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4218 <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
|
4219 <tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4220 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
|
4221 (<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
|
4222 </tag-desc> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4223 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4224 <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
|
4225 <value>options</value>])</literal></tag-name> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4226 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4227 Synchronously retrieves |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4228 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
|
4229 for the specified <literal>path</literal> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4230 (<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
|
4231 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
|
4232 <literal>string</literal> or |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4233 <literal>buffer</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4234 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
|
4235 an object with the following keys: |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4236 <list type="tag"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4237 <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
|
4238 <tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4239 a boolean value which indicates whether |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4240 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
|
4241 rather than returning <literal>undefined</literal>, |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4242 by default is <literal>true</literal>. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4243 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4244 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4245 </tag-desc> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4246 |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4247 <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
|
4248 <value>path</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4249 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4250 Synchronously creates the link called <literal>path</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4251 pointing to <literal>target</literal> using |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4252 <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
|
4253 (<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
|
4254 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
|
4255 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4256 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4257 <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
|
4258 <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
|
4259 <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
|
4260 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4261 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
|
4262 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
|
4263 (<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
|
4264 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4265 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4266 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4267 <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
|
4268 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4269 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
|
4270 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4271 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4272 <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
|
4273 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4274 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
|
4275 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4276 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4277 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4278 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4279 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4280 <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
|
4281 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4282 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
|
4283 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
|
4284 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
|
4285 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4286 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4287 <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
|
4288 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4289 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
|
4290 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
|
4291 <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
|
4292 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4293 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4294 <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
|
4295 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4296 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
|
4297 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
|
4298 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4299 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4300 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4301 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
|
4302 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4303 <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
|
4304 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4305 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4306 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4307 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4308 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4309 <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
|
4310 <value>string</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4311 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4312 <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
|
4313 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4314 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
|
4315 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
|
4316 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
|
4317 (<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
|
4318 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4319 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4320 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4321 <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
|
4322 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4323 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
|
4324 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4325 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4326 <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
|
4327 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4328 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
|
4329 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
|
4330 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4331 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4332 <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
|
4333 See also |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4334 <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
|
4335 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4336 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4337 <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
|
4338 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4339 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
|
4340 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
|
4341 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4342 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4343 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4344 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4345 |
2509
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4346 <tag-name id="fs_unlinksync"><literal>unlinkSync(<value>path</value>)</literal></tag-name> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4347 <tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4348 Synchronously unlinks a file by <literal>path</literal> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4349 (<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
|
4350 </tag-desc> |
827a6d7fe108
Reordered alphabetically njs file system methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2508
diff
changeset
|
4351 |
2570
44792f1ee284
Added IDs to methods in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2569
diff
changeset
|
4352 <tag-name id="fs_writefilesync"><literal>writeFileSync(<value>filename</value>, |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4353 <value>data</value>[, |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4354 <value>options</value>])</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4355 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4356 Synchronously writes <literal>data</literal> to a file |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4357 with provided <literal>filename</literal>. |
2604
a29676472a11
Added Buffer object info to some njs methods.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2601
diff
changeset
|
4358 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
|
4359 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
|
4360 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
|
4361 if the file exists, it will be replaced. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4362 The <literal>options</literal> parameter is expected to be |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4363 an object with the following keys: |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4364 <list type="tag"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4365 <tag-name><literal>mode</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4366 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4367 mode option, by default is <literal>0o666</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4368 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4369 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4370 <tag-name><literal>flag</literal></tag-name> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4371 <tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4372 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
|
4373 by default is <literal>w</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4374 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4375 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4376 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4377 <example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4378 >> var fs = require('fs') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4379 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4380 >> var file = fs.writeFileSync('hello.txt', 'Hello world') |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4381 undefined |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4382 </example> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4383 </tag-desc> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4384 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4385 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4386 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4387 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4388 |
2563
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4389 <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
|
4390 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4391 <para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4392 <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
|
4393 a file or a subdirectory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4394 When |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4395 <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
|
4396 is called with the |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4397 <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
|
4398 option, |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4399 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
|
4400 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4401 <list type= "bullet" compact="no"> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4402 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4403 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4404 <literal>dirent.isBlockDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4405 <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
|
4406 a block device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4407 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4408 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4409 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4410 <literal>dirent.isCharacterDevice()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4411 <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
|
4412 a character device. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4413 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4414 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4415 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4416 <literal>dirent.isDirectory()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4417 <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
|
4418 a file system directory. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4419 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4420 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4421 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4422 <literal>dirent.isFIFO()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4423 <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
|
4424 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
|
4425 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4426 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4427 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4428 <literal>dirent.isFile()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4429 <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
|
4430 a regular file. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4431 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4432 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4433 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4434 <literal>dirent.isSocket()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4435 <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
|
4436 a socket. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4437 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4438 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4439 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4440 <literal>dirent.isSymbolicLink()</literal>—returns |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4441 <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
|
4442 a symbolic link. |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4443 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4444 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4445 <listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4446 <literal>dirent.name</literal>— |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4447 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
|
4448 </listitem> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4449 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4450 </list> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4451 </para> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4452 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4453 </section> |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4454 |
428a8cf1911b
Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2546
diff
changeset
|
4455 |
2887
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4456 <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
|
4457 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4458 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4459 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
|
4460 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
|
4461 (<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
|
4462 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
|
4463 <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
|
4464 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
|
4465 <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
|
4466 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
|
4467 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
|
4468 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
|
4469 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
|
4470 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4471 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4472 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4473 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4474 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4475 <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
|
4476 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4477 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
|
4478 to complete. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4479 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
|
4480 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4481 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4482 <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
|
4483 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4484 The numeric file descriptor |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4485 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
|
4486 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4487 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4488 <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
|
4489 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4490 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4491 <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
|
4492 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4493 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
|
4494 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4495 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4496 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4497 <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
|
4498 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4499 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
|
4500 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
|
4501 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4502 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4503 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4504 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4505 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4506 <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
|
4507 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4508 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
|
4509 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
|
4510 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4511 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4512 <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
|
4513 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4514 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
|
4515 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
|
4516 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4517 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4518 <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
|
4519 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4520 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
|
4521 the value can be |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4522 <literal>integer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4523 <literal>null</literal>. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4524 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
|
4525 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
|
4526 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
|
4527 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
|
4528 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4529 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4530 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4531 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
|
4532 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
|
4533 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4534 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4535 <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
|
4536 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4537 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
|
4538 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4539 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4540 <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
|
4541 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4542 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
|
4543 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4544 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4545 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4546 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4547 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4548 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4549 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4550 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4551 <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
|
4552 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4553 Fulfills with an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4554 <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
|
4555 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
|
4556 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4557 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4558 <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
|
4559 <value>offset</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4560 <value>length</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4561 <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
|
4562 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4563 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
|
4564 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4565 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4566 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4567 <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
|
4568 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4569 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
|
4570 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4571 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4572 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4573 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4574 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4575 <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
|
4576 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4577 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
|
4578 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
|
4579 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4580 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4581 <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
|
4582 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4583 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
|
4584 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
|
4585 is an offset of |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4586 <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
|
4587 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4588 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4589 <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
|
4590 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4591 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
|
4592 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
|
4593 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4594 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4595 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4596 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
|
4597 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
|
4598 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
|
4599 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4600 <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
|
4601 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4602 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4603 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4604 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
|
4605 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4606 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4607 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4608 <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
|
4609 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4610 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
|
4611 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4612 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4613 <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
|
4614 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4615 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
|
4616 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4617 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4618 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4619 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4620 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4621 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4622 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4623 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
|
4624 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
|
4625 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4626 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4627 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4628 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4629 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4630 <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
|
4631 <value>position</value>[, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4632 <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
|
4633 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4634 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
|
4635 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4636 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4637 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4638 <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
|
4639 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4640 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
|
4641 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
|
4642 can be an |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4643 <literal>integer</literal> or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4644 <literal>null</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4645 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
|
4646 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
|
4647 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
|
4648 See the POSIX |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4649 <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
|
4650 documentation for details. |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4651 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4652 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4653 <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
|
4654 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4655 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
|
4656 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4657 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4658 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4659 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
|
4660 containing two properties: |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4661 <list type="tag"> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4662 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4663 <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
|
4664 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4665 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
|
4666 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4667 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4668 <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
|
4669 <tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4670 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
|
4671 <literal>Buffer</literal>, |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4672 <literal>TypedArray</literal>, or |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4673 <literal>DataView</literal> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4674 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4675 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4676 <para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4677 <note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4678 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
|
4679 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
|
4680 </note> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4681 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4682 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4683 </tag-desc> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4684 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4685 </list> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4686 </para> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4687 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4688 </section> |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4689 |
155c8745f596
Documented new fs methods and fs.FileHandle in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2884
diff
changeset
|
4690 |
2818
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4691 <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
|
4692 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4693 <para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4694 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
|
4695 The object is returned from |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4696 <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
|
4697 <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
|
4698 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4699 <list type= "bullet" compact="no"> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4700 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4701 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4702 <literal>stats.isBlockDevice()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4703 <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
|
4704 a block device. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4705 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4706 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4707 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4708 <literal>stats.isDirectory()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4709 <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
|
4710 a file system directory. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4711 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4712 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4713 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4714 <literal>stats.isFIFO()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4715 <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
|
4716 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
|
4717 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4718 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4719 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4720 <literal>stats.isFile()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4721 <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
|
4722 a regular file. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4723 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4724 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4725 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4726 <literal>stats.isSocket()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4727 <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
|
4728 a socket. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4729 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4730 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4731 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4732 <literal>stats.isSymbolicLink()</literal>—returns |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4733 <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
|
4734 a symbolic link. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4735 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4736 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4737 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4738 <literal>stats.dev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4739 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
|
4740 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4741 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4742 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4743 <literal>stats.ino</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4744 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
|
4745 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4746 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4747 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4748 <literal>stats.mode</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4749 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
|
4750 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4751 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4752 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4753 <literal>stats.nlink</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4754 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
|
4755 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4756 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4757 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4758 <literal>stats.uid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4759 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
|
4760 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4761 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4762 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4763 <literal>stats.gid</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4764 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
|
4765 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4766 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4767 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4768 <literal>stats.rdev</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4769 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
|
4770 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4771 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4772 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4773 <literal>stats.size</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4774 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
|
4775 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4776 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4777 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4778 <literal>stats.blksize</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4779 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
|
4780 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4781 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4782 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4783 <literal>stats.blocks</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4784 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
|
4785 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4786 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4787 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4788 <literal>stats.atimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4789 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
|
4790 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4791 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4792 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4793 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4794 <literal>stats.mtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4795 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
|
4796 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4797 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4798 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4799 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4800 <literal>stats.ctimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4801 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
|
4802 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4803 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4804 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4805 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4806 <literal>stats.birthtimeMs</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4807 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
|
4808 in milliseconds since the POSIX Epoch. |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4809 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4810 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4811 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4812 <literal>stats.atime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4813 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
|
4814 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4815 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4816 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4817 <literal>stats.mtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4818 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
|
4819 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4820 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4821 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4822 <literal>stats.ctime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4823 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
|
4824 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4825 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4826 <listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4827 <literal>stats.birthtime</literal>— |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4828 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
|
4829 </listitem> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4830 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4831 </list> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4832 </para> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4833 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4834 </section> |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4835 |
2594d336342d
Documented fs.Stats, statSync and lstatSync in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2800
diff
changeset
|
4836 |
2507 | 4837 <section id="access_const" name="File Access Constants"> |
4838 | |
4839 <para> | |
4840 The <link id="fs_accesssync"><literal>access()</literal></link> method | |
4841 can accept the following flags. | |
4842 These flags are exported by <literal>fs.constants</literal>: | |
4843 | |
4844 <list type= "bullet" compact="no"> | |
4845 | |
4846 <listitem> | |
4847 <literal>F_OK</literal>—indicates that the file | |
4848 is visible to the calling process, | |
4849 used by default if no mode is specified | |
4850 </listitem> | |
4851 | |
4852 <listitem> | |
4853 <literal>R_OK</literal>—indicates that the file can be | |
4854 read by the calling process | |
4855 </listitem> | |
4856 | |
4857 <listitem> | |
4858 <literal>W_OK</literal>—indicates that the file can be | |
4859 written by the calling process | |
4860 </listitem> | |
4861 | |
4862 <listitem> | |
4863 <literal>X_OK</literal>—indicates that the file can be | |
4864 executed by the calling process | |
4865 </listitem> | |
4866 | |
4867 </list> | |
4868 </para> | |
4869 | |
4870 </section> | |
4871 | |
4872 | |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4873 <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
|
4874 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4875 <para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4876 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
|
4877 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4878 <list type= "bullet" compact="no"> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4879 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4880 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4881 <literal>a</literal>—open a file for appending. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4882 The file is created if it does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4883 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4884 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4885 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4886 <literal>ax</literal>—the same as <literal>a</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4887 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4888 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4889 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4890 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4891 <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
|
4892 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
|
4893 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4894 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4895 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
4896 <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
|
4897 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4898 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4899 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4900 <listitem> |
2579
63cef7604e0d
Minor review of njs Reference for typos and style.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2578
diff
changeset
|
4901 <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
|
4902 in synchronous mode. |
2204
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4903 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
|
4904 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4905 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4906 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4907 <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
|
4908 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4909 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
|
4910 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4911 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4912 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4913 <literal>r</literal>—open a file for reading. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4914 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4915 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4916 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4917 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4918 <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
|
4919 An exception occurs if the file does not exist |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4920 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4921 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4922 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4923 <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
|
4924 in synchronous mode. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4925 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
|
4926 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4927 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4928 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4929 <literal>w</literal>—open a file for writing. |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4930 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
|
4931 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4932 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4933 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4934 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4935 <literal>wx</literal>—the same as <literal>w</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4936 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4937 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4938 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4939 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4940 <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
|
4941 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
|
4942 If the file exists, it will be replaced |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4943 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4944 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4945 <listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4946 <literal>wx+</literal>—the same as <literal>w+</literal> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4947 but fails if the file already exists |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4948 </listitem> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4949 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4950 </list> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4951 </para> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4952 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4953 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4954 |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4955 </section> |
001f2d905fd9
Documented fileSystem methods in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2203
diff
changeset
|
4956 |
2583
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4957 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4958 <section id="querystring" name="Query String"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4959 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4960 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4961 The Query String module provides support |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4962 for parsing and formatting URL query strings |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4963 (<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
|
4964 The Query String module object is returned by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4965 <literal>require('querystring')</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4966 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4967 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4968 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4969 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4970 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4971 <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
|
4972 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4973 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4974 <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
|
4975 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4976 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4977 <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
|
4978 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4979 is an alias for |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4980 <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
|
4981 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4982 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4983 <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
|
4984 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4985 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4986 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
|
4987 returns an escaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4988 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4989 <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
|
4990 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4991 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4992 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4993 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4994 <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
|
4995 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4996 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4997 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4998 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
4999 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5000 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
|
5001 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5002 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5003 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5004 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5005 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
|
5006 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5007 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5008 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5009 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5010 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5011 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
|
5012 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5013 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5014 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5015 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5016 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
|
5017 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5018 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5019 <tag-name><literal>decodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5020 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5021 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5022 Function used |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5023 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
|
5024 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5025 <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
|
5026 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5027 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5028 <tag-name><literal>maxKeys</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5029 <value>number</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5030 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5031 the maximum number of keys to parse, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5032 by default is <literal>1000</literal>. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5033 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
|
5034 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5035 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5036 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5037 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
|
5038 to use the UTF-8 encoding, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5039 invalid UTF-8 sequences will be replaced with |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5040 the <literal>U+FFFD</literal> replacement character. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5041 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5042 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5043 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5044 For example, for the following query string |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5045 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5046 'foo=bar&abc=xyz&abc=123' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5047 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5048 the output will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5049 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5050 { |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5051 foo: 'bar', |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5052 abc: ['xyz', '123'] |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5053 } |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5054 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5055 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5056 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5057 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5058 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5059 <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
|
5060 <value>separator</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5061 <value>equal</value>[, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5062 <value>options</value>]]])</literal></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5063 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5064 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5065 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
|
5066 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5067 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5068 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5069 The <literal>separator</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5070 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
|
5071 by default is “<literal>&</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5072 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5073 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5074 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5075 The <literal>equal</literal> parameter is a substring |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5076 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
|
5077 by default is “<literal>=</literal>”. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5078 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5079 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5080 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5081 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
|
5082 an object with the following keys: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5083 <list type="tag"> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5084 <tag-name><literal>encodeURIComponent</literal> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5085 <value>function</value></tag-name> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5086 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5087 The function to use when converting |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5088 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
|
5089 by default is |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5090 <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
|
5091 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5092 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5093 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5094 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5095 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5096 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5097 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
|
5098 are encoded as UTF-8. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5099 If other encoding is required, then |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5100 <literal>encodeURIComponent</literal> option should be specified. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5101 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5102 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5103 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5104 For example, for the following command |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5105 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5106 querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], 123: '' }); |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5107 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5108 the query string will be: |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5109 <example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5110 'foo=bar&baz=qux&baz=quux&123=' |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5111 </example> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5112 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5113 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5114 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5115 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5116 <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
|
5117 <tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5118 <para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5119 Performs decoding of URL percent-encoded characters |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5120 of the <literal>string</literal>, |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5121 returns an unescaped query string. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5122 The method is used by |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5123 <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
|
5124 and should not be used directly. |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5125 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5126 </tag-desc> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5127 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5128 </list> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5129 </para> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5130 |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5131 </section> |
cd97adddd757
Documented Query String in njs Reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2582
diff
changeset
|
5132 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5133 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5134 <section id="xml" name="XML"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5135 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5136 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5137 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
|
5138 (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
|
5139 The XML module object is returned by |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5140 <literal>require('xml')</literal>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5141 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5142 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5143 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5144 Example: |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5145 <example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5146 const xml = require("xml"); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5147 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
|
5148 let doc = xml.parse(data); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5149 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5150 console.log(doc.note.to.$text) /* 'Tove' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5151 console.log(doc.note.to.$attr$b) /* 'bar' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5152 console.log(doc.note.$tags[1].$text) /* 'Jani' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5153 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5154 let dec = new TextDecoder(); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5155 let c14n = dec.decode(xml.exclusiveC14n(doc.note)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5156 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
|
5157 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5158 c14n = dec.decode(xml.exclusiveC14n(doc.note.to)); |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5159 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
|
5160 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5161 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
|
5162 console.log(c14n) /* '<note><from>Jani</from></note>' */ |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5163 </example> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5164 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5165 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5166 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5167 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5168 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5169 <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
|
5170 <value>Buffer</value>)</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5171 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5172 Parses a string or Buffer for an XML document, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5173 returns an |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5174 <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
|
5175 representing the parsed XML document. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5176 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5177 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5178 <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
|
5179 <value>excluding_node</value>])</literal></tag-name> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5180 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5181 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
|
5182 <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
|
5183 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
|
5184 <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
|
5185 <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
|
5186 around XML structure. |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5187 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5188 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5189 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5190 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5191 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5192 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5193 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5194 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
|
5195 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5196 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5197 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5198 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5199 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5200 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5201 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5202 <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
|
5203 <value>excluding_node</value>[, |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5204 <value>withComments</value> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5205 [,<value>prefix_list</value>]]])</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5206 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5207 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
|
5208 <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
|
5209 Canonicalization Version 1.0</link>. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5210 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5211 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5212 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5213 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5214 <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
|
5215 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5216 is |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5217 <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
|
5218 <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
|
5219 around XML structure |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5220 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5221 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5222 <tag-name><literal>excluding_node</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5223 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5224 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
|
5225 corresponding to the node and its children |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5226 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5227 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5228 <tag-name><literal>withComments</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5229 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5230 a boolean value, <literal>false</literal> by default. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5231 If <literal>true</literal>, canonicalization corresponds to |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5232 <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
|
5233 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
|
5234 Returns Buffer object that contains canonicalized output. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5235 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5236 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5237 <tag-name><literal>prefix_list</literal></tag-name> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5238 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5239 an optional string with a space separated namespace prefixes |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5240 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
|
5241 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5242 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5243 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5244 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5245 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5246 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5247 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5248 <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
|
5249 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5250 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5251 <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
|
5252 (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
|
5253 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5254 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5255 <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
|
5256 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5257 The same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5258 <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
|
5259 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
|
5260 (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
|
5261 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5262 |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5263 <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
|
5264 <tag-desc> |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5265 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
|
5266 the root node of the document. |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5267 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5268 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5269 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5270 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5271 <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
|
5272 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5273 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
|
5274 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5275 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5276 <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
|
5277 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5278 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
|
5279 <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
|
5280 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5281 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5282 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5283 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5284 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5285 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5286 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5287 <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
|
5288 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5289 An XMLNode wrapper object around XML tag node. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5290 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5291 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5292 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5293 <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
|
5294 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5295 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5296 <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
|
5297 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5298 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5299 <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
|
5300 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5301 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
|
5302 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5303 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
|
5304 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5305 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5306 <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
|
5307 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5308 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5309 <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
|
5310 <value>xyz</value>)</literal></link> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5311 (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
|
5312 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5313 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5314 <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
|
5315 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5316 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
|
5317 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
|
5318 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5319 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5320 <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
|
5321 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5322 the name of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5323 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5324 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5325 <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
|
5326 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5327 the namespace of the node |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5328 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5329 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5330 <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
|
5331 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5332 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
|
5333 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5334 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5335 <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
|
5336 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5337 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
|
5338 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5339 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
|
5340 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5341 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5342 <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
|
5343 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5344 an array of all children tags |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5345 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5346 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5347 <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
|
5348 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5349 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5350 <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
|
5351 <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
|
5352 <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
|
5353 (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
|
5354 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5355 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5356 <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
|
5357 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5358 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
|
5359 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5360 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
|
5361 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5362 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5363 <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
|
5364 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5365 the content of the node, |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5366 writable |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5367 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
|
5368 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5369 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5370 <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
|
5371 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5372 the same as |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5373 <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
|
5374 (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
|
5375 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5376 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5377 <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
|
5378 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5379 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
|
5380 (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
|
5381 <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
|
5382 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5383 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5384 <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
|
5385 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5386 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
|
5387 (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
|
5388 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5389 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5390 <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
|
5391 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5392 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
|
5393 (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
|
5394 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5395 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5396 <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
|
5397 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5398 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
|
5399 (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
|
5400 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
|
5401 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5402 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5403 <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
|
5404 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5405 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
|
5406 (<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
|
5407 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5408 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5409 <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
|
5410 <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
|
5411 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5412 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
|
5413 (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
|
5414 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
|
5415 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
|
5416 </tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5417 |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5418 <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
|
5419 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5420 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
|
5421 (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
|
5422 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
|
5423 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5424 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5425 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5426 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5427 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5428 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5429 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5430 <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
|
5431 <tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5432 An XMLAttrs wrapper object around XML node attributes. |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5433 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5434 <para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5435 <list type="tag"> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5436 |
2942
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5437 <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
|
5438 <tag-desc> |
ee84a44fa7f7
Documented XMLNode API for modification XML docs in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2941
diff
changeset
|
5439 the attribute value of <value>abc</value> |
2934
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5440 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5441 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5442 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5443 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5444 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5445 </tag-desc> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5446 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5447 </list> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5448 </para> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5449 |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5450 </section> |
41870b949ac9
Documented XML module in njs.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2933
diff
changeset
|
5451 |
2951
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5452 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5453 <section id="zlib" name="zlib"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5454 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5455 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5456 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
|
5457 “deflate” and “inflate” algorithms |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5458 (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
|
5459 The zlib module object is returned by |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5460 <literal>require('zlib')</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5461 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5462 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5463 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5464 <list type="tag"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5465 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5466 <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
|
5467 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5468 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5469 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5470 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
|
5471 and does not append a zlib header. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5472 The buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5473 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5474 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5475 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5476 <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
|
5477 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5478 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
|
5479 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5480 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5481 <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
|
5482 <value>Buffer</value>[, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5483 <value>options</value>])</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5484 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5485 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
|
5486 The Buffer value can be a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5487 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5488 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5489 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5490 <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
|
5491 <link id="zlib_options"/>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5492 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
|
5493 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5494 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5495 <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
|
5496 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5497 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5498 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
|
5499 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
|
5500 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5501 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5502 <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
|
5503 <value>Buffer</value>)</literal></tag-name> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5504 <tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5505 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
|
5506 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
|
5507 </tag-desc> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5508 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5509 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5510 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5511 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5512 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5513 <section id="zlib_options" name="zlib options"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5514 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5515 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5516 <list type= "bullet" compact="no"> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5517 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5518 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5519 <literal>chunkSize</literal>—is an integer, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5520 by default is <literal>1024</literal> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5521 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5522 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5523 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5524 <literal>dictionary</literal>—is a |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5525 <literal>Buffer</literal>, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5526 <literal>TypedArray</literal>, or |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5527 <literal>DataView</literal>. |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5528 by default is empty |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5529 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5530 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5531 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5532 <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
|
5533 see <link id="zlib_compression_levels"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5534 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5535 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5536 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5537 <literal>memLevel</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5538 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
|
5539 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5540 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5541 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5542 <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
|
5543 see <link id="zlib_compression_strategy"/> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5544 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5545 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5546 <listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5547 <literal>windowBits</literal>—is an integer |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5548 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
|
5549 for raw data, |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5550 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
|
5551 for an ordinary stream |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5552 </listitem> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5553 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5554 </list> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5555 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5556 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5557 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5558 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5559 <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
|
5560 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5561 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5562 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5563 <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
|
5564 <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
|
5565 <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
|
5566 <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
|
5567 <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
|
5568 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5569 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5570 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5571 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5572 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5573 <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
|
5574 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5575 <para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5576 <table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5577 <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
|
5578 <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
|
5579 <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
|
5580 <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
|
5581 <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
|
5582 <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
|
5583 </table> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5584 </para> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5585 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5586 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5587 |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5588 </section> |
c231cd046ac5
Documented the zlib module in njs reference.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
2950
diff
changeset
|
5589 |
2176 | 5590 </section> |
5591 | |
2175
cd4889fdcfa4
Moved njs HTTP and Stream API to a separate page.
Yaroslav Zhuravlev <yar@nginx.com>
parents:
diff
changeset
|
5592 </article> |