Discover Centmin Mod today
Register Now

Nginx [nginx-announce] njs-0.3.9

Discussion in 'Nginx and PHP-FPM news & discussions' started by eva2000, Mar 4, 2020.

  1. eva2000

    eva2000 Administrator Staff Member

    May 24, 2014
    Brisbane, Australia
    Local Time:
    12:39 PM
    Nginx 1.21.x
    MariaDB 10.x

    I'm glad to announce a new release of NGINX JavaScript module (njs).

    This release proceeds to extend the coverage of ECMAScript

    Notable new features:
    - Promises API for "fs" module.
    : var fs = require('fs').promises;
    : fs.readFile('/file/path').then(data => r.return(200, data));

    - detached r.subrequest(): Running a subrequest in the log phase
    : nginx.conf:
    : ...
    : js_set $js_log js_log;
    : ...
    : log_format subrequest_log "...$js_log";
    : access_log /log/path.log subrequest_log;
    : nginx.js:
    : function js_log(r) {
    : r.subrequest('/_log', {detached:true});
    : return '';
    : }

    You can learn more about njs:

    - Overview and introduction:
    - Presentation:
    - Using node modules with njs:

    Feel free to try it and give us feedback on:

    - Github:
    - Mailing list:

    Changes with njs 0.3.9 03 Mar 2020

    nginx modules:

    *) Feature: added detached mode for r.subrequest(). Responses to
    detached subrequests are ignored. Unlike ordinary subrequests,
    a detached subrequest can be created inside a variable handler.


    *) Feature: added promises API for "fs" module.
    Thanks to Artem S. Povalyukhin.

    *) Feature: extended "fs" module. Added access(), symlink(), unlink(),
    realpath() and friends.
    Thanks to Artem S. Povalyukhin.

    *) Improvement: introduced memory-efficient ordinary arrays.

    *) Improvement: lexer refactoring.

    *) Bugfix: fixed matching of native functions in backtraces.

    *) Bugfix: fixed callback invocations in "fs" module.
    Thanks to Artem S. Povalyukhin.

    *) Bugfix: fixed Object.getOwnPropertySymbols().

    *) Bugfix: fixed heap-buffer-overflow in njs_json_append_string().

    *) Bugfix: fixed encodeURI() and decodeURI() according to
    the specification.

    *) Bugfix: fixed Number.prototype.toPrecision().

    *) Bugfix: fixed handling of space argument in JSON.stringify().

    *) Bugfix: fixed JSON.stringify() with Number() and String() objects.

    *) Bugfix: fixed Unicode Escaping in JSON.stringify() according
    to specification.

    *) Bugfix: fixed non-native module importing.
    Thanks to 洪志道 (Hong Zhi Dao).

    *) Bugfix: fixed njs.dump() with the Date() instance in a container.
    nginx-announce mailing list

    Continue reading...