Types: extending data types for methods with NjsStringLike args.
diff --git a/test/ts/test.ts b/test/ts/test.ts
index 30d92da..9a079a0 100644
--- a/test/ts/test.ts
+++ b/test/ts/test.ts
@@ -49,6 +49,7 @@
     // r.log
 
     r.log(bs);
+    r.log(Buffer.from("abc"));
     r.log(r.headersOut['Connection'] ?? '');
 
     // r.variables
@@ -61,7 +62,7 @@
     r.subrequest('/p/sub2', {method:'POST'}).then(reply => r.return(reply.status));
     vod = r.subrequest('/p/sub3', reply => r.return(reply.status));
     vod = r.subrequest('/p/sub4', {method:'POST'}, reply => r.return(reply.status));
-    vod = r.subrequest('/p/sub5', {detached:true});
+    vod = r.subrequest(Buffer.from('/p/sub5'), {detached:true});
     // Warning: vod = r.subrequest('/p/sub9', {detached:true}, reply => r.return(reply.status));
     r.subrequest('/p/sub6', 'a=1&b=2').then(reply => r.return(reply.status,
                                         JSON.stringify(JSON.parse(reply.responseBody ?? ''))));
@@ -73,6 +74,8 @@
 
     s = fs.readFileSync('/path', 'utf8');
     s = fs.readFileSync(Buffer.from('/path'), {encoding:'hex'});
+
+    fs.writeFileSync('/path', Buffer.from('abc'));
 }
 
 function qs_module(str: NjsByteString) {
diff --git a/ts/ngx_http_js_module.d.ts b/ts/ngx_http_js_module.d.ts
index 9336403..92833d8 100644
--- a/ts/ngx_http_js_module.d.ts
+++ b/ts/ngx_http_js_module.d.ts
@@ -263,7 +263,7 @@
      * Writes a string to the error log on the error level of logging.
      * @param message Message to log.
      */
-    error(message: NjsStringLike): void;
+    error(message: NjsStringOrBuffer): void;
     /**
      * Finishes sending a response to the client.
      */
@@ -286,12 +286,12 @@
      * The actual redirect happens after the handler execution is completed.
      * @param uri Location to redirect to.
      */
-    internalRedirect(uri: NjsStringLike): void;
+    internalRedirect(uri: NjsStringOrBuffer): void;
     /**
      * Writes a string to the error log on the info level of logging.
      * @param message Message to log.
      */
-    log(message: NjsStringLike): void;
+    log(message: NjsStringOrBuffer): void;
     /**
      * HTTP method.
      */
@@ -323,11 +323,11 @@
      * @param status Respose status code.
      * @param body Respose body.
      */
-    return(status: number, body?: NjsStringLike): void;
+    return(status: number, body?: NjsStringOrBuffer): void;
     /**
      * Sends the HTTP headers to the client.
      */
-    send(part: NjsStringLike): void;
+    send(part: NjsStringOrBuffer): void;
     /**
      * Sends the HTTP headers to the client.
      */
@@ -346,11 +346,11 @@
      * @param options Subrequest options.
      * @param callback Completion callback.
      */
-    subrequest(uri: NjsStringLike, options: NginxSubrequestOptions & { detached: true }): void;
-    subrequest(uri: NjsStringLike, options?: NginxSubrequestOptions | string): Promise<NginxHTTPRequest>;
-    subrequest(uri: NjsStringLike, options: NginxSubrequestOptions & { detached?: false } | string,
+    subrequest(uri: NjsStringOrBuffer, options: NginxSubrequestOptions & { detached: true }): void;
+    subrequest(uri: NjsStringOrBuffer, options?: NginxSubrequestOptions | string): Promise<NginxHTTPRequest>;
+    subrequest(uri: NjsStringOrBuffer, options: NginxSubrequestOptions & { detached?: false } | string,
                callback:(reply:NginxHTTPRequest) => void): void;
-    subrequest(uri: NjsStringLike, callback:(reply:NginxHTTPRequest) => void): void;
+    subrequest(uri: NjsStringOrBuffer, callback:(reply:NginxHTTPRequest) => void): void;
     /**
      * Current URI in request, normalized.
      */
@@ -363,5 +363,5 @@
      * Writes a string to the error log on the warn level of logging.
      * @param message Message to log.
      */
-    warn(message: NjsStringLike): void;
+    warn(message: NjsStringOrBuffer): void;
 }
diff --git a/ts/ngx_stream_js_module.d.ts b/ts/ngx_stream_js_module.d.ts
index 46aa76d..3e01b91 100644
--- a/ts/ngx_stream_js_module.d.ts
+++ b/ts/ngx_stream_js_module.d.ts
@@ -110,12 +110,12 @@
      * Writes a string to the error log on the error level of logging.
      * @param message Message to log.
      */
-    error(message: NjsStringLike): void;
+    error(message: NjsStringOrBuffer): void;
     /**
      * Writes a string to the error log on the info level of logging.
      * @param message Message to log.
      */
-    log(message: NjsStringLike): void;
+    log(message: NjsStringOrBuffer): void;
     /**
      * Unregisters the callback set by on() method.
      */
@@ -135,7 +135,7 @@
      * @param options Object used to override nginx buffer flags derived from
      * an incoming data chunk buffer.
      */
-    send(data: NjsStringLike, options?: NginxStreamSendOptions): void;
+    send(data: NjsStringOrBuffer, options?: NginxStreamSendOptions): void;
     /**
      * nginx variables object.
      */
@@ -144,5 +144,5 @@
      * Writes a string to the error log on the warn level of logging.
      * @param message Message to log.
      */
-    warn(message: NjsStringLike): void;
+    warn(message: NjsStringOrBuffer): void;
 }
diff --git a/ts/njs_core.d.ts b/ts/njs_core.d.ts
index 8783b3b..ae6d07c 100644
--- a/ts/njs_core.d.ts
+++ b/ts/njs_core.d.ts
@@ -584,6 +584,7 @@
     writeFloatLE(value: number, offset?: number): number;
 }
 
+type NjsStringOrBuffer = NjsStringLike | Buffer | DataView | TypedArray;
 
 // Global objects
 
diff --git a/ts/njs_modules/crypto.d.ts b/ts/njs_modules/crypto.d.ts
index 345a2d1..ea554f3 100644
--- a/ts/njs_modules/crypto.d.ts
+++ b/ts/njs_modules/crypto.d.ts
@@ -10,7 +10,7 @@
         /**
          * Updates the hash content with the given `data` and returns self.
          */
-        update(data: NjsStringLike | Buffer | DataView | TypedArray): Hash;
+        update(data: NjsStringOrBuffer): Hash;
 
         /**
          * Calculates the digest of all of the data passed using `hash.update()`.
@@ -31,7 +31,7 @@
         /**
          * Updates the HMAC content with the given `data` and returns self.
          */
-        update(data: NjsStringLike | Buffer | DataView | TypedArray): Hmac;
+        update(data: NjsStringOrBuffer): Hmac;
 
         /**
          * Calculates the HMAC digest of all of the data passed using `hmac.update()`.
@@ -65,7 +65,7 @@
          * @param key The secret key.
          * @returns An `HMAC` object.
          */
-        createHmac(algorithm: Algorithm, key: NjsStringLike): Hmac;
+        createHmac(algorithm: Algorithm, key: NjsStringOrBuffer): Hmac;
     }
 
     const crypto: Crypto;
diff --git a/ts/njs_modules/fs.d.ts b/ts/njs_modules/fs.d.ts
index cc24f24..a7a4589 100644
--- a/ts/njs_modules/fs.d.ts
+++ b/ts/njs_modules/fs.d.ts
@@ -124,7 +124,7 @@
          *   If `mode` is not supplied, the default of `0o666` is used.
          *   If `flag` is not supplied, the default of `'a'` is used.
          */
-        appendFile(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): Promise<void>;
+        appendFile(path: PathLike, data: NjsStringOrBuffer, options?: WriteFileOptions): Promise<void>;
 
         /**
          * Asynchronously creates a directory at the specified `path`.
@@ -219,7 +219,7 @@
          *   If `mode` is not supplied, the default of `0o666` is used.
          *   If `flag` is not supplied, the default of `'w'` is used.
          */
-        writeFile(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): Promise<void>;
+        writeFile(path: PathLike, data: NjsStringOrBuffer, options?: WriteFileOptions): Promise<void>;
     }
 
     interface NjsFS {
@@ -264,7 +264,7 @@
          *   If `mode` is not supplied, the default of `0o666` is used.
          *   If `flag` is not supplied, the default of `'a'` is used.
          */
-        appendFileSync(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): void;
+        appendFileSync(path: PathLike, data: NjsStringOrBuffer, options?: WriteFileOptions): void;
 
         /**
          * Synchronously creates a directory at the specified `path`.
@@ -373,7 +373,7 @@
          *   If `mode` is not supplied, the default of `0o666` is used.
          *   If `flag` is not supplied, the default of `'w'` is used.
          */
-        writeFileSync(path: PathLike, data: NjsStringLike | Buffer, options?: WriteFileOptions): void;
+        writeFileSync(path: PathLike, data: NjsStringOrBuffer, options?: WriteFileOptions): void;
     }
 
     const fs: NjsFS;