Dmitry Volyntsev
[nginx-announce] njs-0.7.7
August 30, 2022 07:04PM

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

Notable new features:
- advances fs API:
New API allows to open a file and read from and write to at
specified location without reading the whole file.

import fs from 'fs';

async function modifying_large_file() {
let fh = await'/my/path');

let buf = Buffer.alloc(4);

await, 0, 4, 64);

console.log(`read ${buf.toString('hex')}`);

// modify part
buf[0] = buf[0] ^ buf[3];

await fh.write(buf, 0, 4, 64);

console.log(`written ${buf.toString('hex')}`);

await fh.close();

Learn more about njs:

- Overview and introduction:
- NGINX JavaScript in Your Web Server Configuration:
- Extending NGINX with Custom Code:
- Using node modules with njs:
- Writing njs code using TypeScript definition files:

Feel free to try it and give us feedback on:

- Github:
- Mailing list:

Additional examples and howtos can be found here:

- Github:

Changes with njs 0.7.7 30 Aug 2022

nginx modules:

*) Feature: the number of nginx configuration contexts where
js directives can be specified is extended.

HTTP: js_import, js_path, js_set and js_var are allowed
in server and location contexts. js_content, js_body_filter
and js_header_filter are allowed in 'if' context.

Stream: js_import, js_path, js_set and js_var are allowed
in server context.

*) Feature: added r.internal property.

*) Bugfix: fixed reading response body in fetch API.

*) Bugfix: fixed "js_fetch_timeout" in stream module.

*) Bugfix: fixed socket leak with 0 fetch timeout.


*) Feature: extended "fs" module. Added fs.openSync(),, fs.fstatSync(), fs.readSync(),

The following properties of FileHandle are implemented:
fd, read(), stat(), write(), close().

*) Bugfix: fixed parseInt(), parseFloat(), Symbol.for()
with no arguments.
nginx-announce mailing list --
To unsubscribe send an email to
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 281
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready