comparison xml/en/docs/njs/reference.xml @ 2663:a33d8f0f48b2

Documented r.done and r.sendBuffer in njs Reference.
author Yaroslav Zhuravlev <yar@nginx.com>
date Thu, 04 Mar 2021 12:56:02 +0000
parents 9fc25ea7a92c
children 529114f1108a
comparison
equal deleted inserted replaced
2662:e4d370d43176 2663:a33d8f0f48b2
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd">
8 8
9 <article name="Reference" 9 <article name="Reference"
10 link="/en/docs/njs/reference.html" 10 link="/en/docs/njs/reference.html"
11 lang="en" 11 lang="en"
12 rev="61"> 12 rev="62">
13 13
14 <section id="summary"> 14 <section id="summary">
15 15
16 <para> 16 <para>
17 <link doc="index.xml">njs</link> provides objects, methods and properties 17 <link doc="index.xml">njs</link> provides objects, methods and properties
46 <list type="tag"> 46 <list type="tag">
47 47
48 <tag-name id="r_args"><literal>r.args{}</literal></tag-name> 48 <tag-name id="r_args"><literal>r.args{}</literal></tag-name>
49 <tag-desc> 49 <tag-desc>
50 request arguments object, read-only 50 request arguments object, read-only
51 </tag-desc>
52
53 <tag-name id="r_done"><literal>r.done()</literal></tag-name>
54 <tag-desc>
55 after calling this function,
56 next data chunks will be passed to client without calling
57 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/>
58 (<link doc="changes.xml" id="njs0.5.2">0.5.2</link>).
59 May be called only from the
60 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/> function
51 </tag-desc> 61 </tag-desc>
52 62
53 <tag-name id="r_error"><literal>r.error(<value>string</value>)</literal></tag-name> 63 <tag-name id="r_error"><literal>r.error(<value>string</value>)</literal></tag-name>
54 <tag-desc> 64 <tag-desc>
55 writes a <literal>string</literal> to the error log 65 writes a <literal>string</literal> to the error log
302 sends a part of the response body to the client. 312 sends a part of the response body to the client.
303 The data sent can be a string or Buffer 313 The data sent can be a string or Buffer
304 (<link doc="changes.xml" id="njs0.5.0">0.5.0</link>) 314 (<link doc="changes.xml" id="njs0.5.0">0.5.0</link>)
305 </tag-desc> 315 </tag-desc>
306 316
317 <tag-name id="r_sendbuffer"><literal>r.sendBuffer(<value>data</value>[,
318 <value>options</value>])</literal></tag-name>
319 <tag-desc>
320 adds data to the chain of data chunks to be forwarded to the next body filter
321 (<link doc="changes.xml" id="njs0.5.2">0.5.2</link>).
322 The actual forwarding happens later,
323 when the all the data chunks of the current chain are processed.
324 <para>
325 The data can be a string or Buffer.
326 The <literal>options</literal> is an object used
327 to override nginx buffer flags derived from an incoming data chunk buffer.
328 The flags can be overridden with the following flags:
329 <list type="tag">
330
331 <tag-name><literal>last</literal></tag-name>
332 <tag-desc>
333 boolean,
334 true if the buffer is the last buffer
335 </tag-desc>
336
337 <tag-name><literal>flush</literal></tag-name>
338 <tag-desc>
339 boolean,
340 true if the buffer should have the <literal>flush</literal> flag
341 </tag-desc>
342 </list>
343 </para>
344 The method may be called only from the
345 <link doc="../http/ngx_http_js_module.xml" id="js_body_filter"/> function.
346 </tag-desc>
347
307 <tag-name id="r_send_header"><literal>r.sendHeader()</literal></tag-name> 348 <tag-name id="r_send_header"><literal>r.sendHeader()</literal></tag-name>
308 <tag-desc> 349 <tag-desc>
309 sends the HTTP headers to the client 350 sends the HTTP headers to the client
310 </tag-desc> 351 </tag-desc>
311 352