Mercurial > hg > nginx-site
comparison xml/en/docs/njs/node_modules.xml @ 2629:5cd72684e5b8
Fixed typo and updated description in Using node modules.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Thu, 03 Dec 2020 12:28:46 +0000 |
parents | fca42223b9fc |
children |
comparison
equal
deleted
inserted
replaced
2628:0ce45b4edb75 | 2629:5cd72684e5b8 |
---|---|
7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> | 7 <!DOCTYPE article SYSTEM "../../../../dtd/article.dtd"> |
8 | 8 |
9 <article name="Using node modules with njs" | 9 <article name="Using node modules with njs" |
10 link="/en/docs/njs/node_modules.html" | 10 link="/en/docs/njs/node_modules.html" |
11 lang="en" | 11 lang="en" |
12 rev="5"> | 12 rev="6"> |
13 | 13 |
14 <section id="intro"> | 14 <section id="intro"> |
15 | 15 |
16 <para> | 16 <para> |
17 Often, a developer wants to use 3rd-party code, | 17 Often, a developer wants to use 3rd-party code, |
349 116, 114, 105, 110, 103 | 349 116, 114, 105, 110, 103 |
350 ] | 350 ] |
351 </example> | 351 </example> |
352 Now let's proceed further with njs: | 352 Now let's proceed further with njs: |
353 <example> | 353 <example> |
354 $ /njs ./njs_bundle.js | 354 $ njs ./njs_bundle.js |
355 Uint8Array [0,0,0,0,12,10,10,84,101,115,116,83,116,114,105,110,103] | 355 Uint8Array [0,0,0,0,12,10,10,84,101,115,116,83,116,114,105,110,103] |
356 </example> | 356 </example> |
357 The last thing will be to use njs-specific API to convert | 357 The last thing will be to use njs-specific API to convert |
358 array into byte string, so it could be usable by nginx module. | 358 array into byte string, so it could be usable by nginx module. |
359 We can add the following snippet before the last line: | 359 We can add the following snippet before the line |
360 <literal>return frame; }</literal>: | |
360 <example> | 361 <example> |
361 if (global.njs) { | 362 if (global.njs) { |
362 return String.bytesFrom(frame) | 363 return String.bytesFrom(frame) |
363 } | 364 } |
364 </example> | 365 </example> |