fix: replace is-utf8 with native nodejs functions

Available since nodejs 18.14
https://nodejs.org/docs/latest-v18.x/api/buffer.html#bufferisutf8input
pull/4770/head
Rotzbua 2024-06-17 23:33:30 +02:00
parent a622d19ba7
commit 6af30f070b
No known key found for this signature in database
GPG Key ID: C69022D529C17845
6 changed files with 6 additions and 8 deletions

View File

@ -51,7 +51,6 @@
"https-proxy-agent": "5.0.1",
"i18next": "21.10.0",
"iconv-lite": "0.6.3",
"is-utf8": "0.2.1",
"js-yaml": "4.1.0",
"json-stringify-safe": "5.0.1",
"jsonata": "2.0.5",
@ -123,6 +122,6 @@
"supertest": "6.3.3"
},
"engines": {
"node": ">=18.5"
"node": ">=18.14"
}
}

View File

@ -19,7 +19,7 @@ module.exports = function(RED) {
var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var fs = require('fs');
var isUtf8 = require('is-utf8');
const { isUtf8 } = require('node:buffer');
const isWindows = process.platform === 'win32'
function ExecNode(n) {
@ -87,7 +87,7 @@ module.exports = function(RED) {
});
var cmd = arg.shift();
// Since 18.20.2/20.12.2, it is invalid to call spawn on Windows with a .bat/.cmd file
// without using shell: true.
// without using shell: true.
const opts = isWindows ? { ...node.spawnOpt, shell: true } : node.spawnOpt
/* istanbul ignore else */
node.debug(cmd+" ["+arg+"]");

View File

@ -18,7 +18,7 @@ module.exports = function(RED) {
"use strict";
const { getProxyForUrl } = require('./lib/proxyHelper');
var mqtt = require("mqtt");
var isUtf8 = require('is-utf8');
const { isUtf8 } = require('node:buffer');
var HttpsProxyAgent = require('https-proxy-agent');
var url = require('url');
const knownMediaTypes = {

View File

@ -24,7 +24,7 @@ module.exports = function(RED) {
var onHeaders = require('on-headers');
var typer = require('content-type');
var mediaTyper = require('media-typer');
var isUtf8 = require('is-utf8');
const { isUtf8 } = require('node:buffer');
var hashSum = require("hash-sum");
function rawBodyParser(req, res, next) {

View File

@ -32,7 +32,6 @@
"hash-sum": "2.0.0",
"hpagent": "1.2.0",
"https-proxy-agent": "5.0.1",
"is-utf8": "0.2.1",
"js-yaml": "4.1.0",
"media-typer": "1.1.0",
"mqtt": "5.7.0",

View File

@ -48,6 +48,6 @@
"@node-rs/bcrypt": "1.10.4"
},
"engines": {
"node": ">=18.5"
"node": ">=18.14"
}
}