Update utils.js (#2981)

Fixed following error

    ReferenceError: TextEncoder is not defined
This commit is contained in:
sudarshanvn 2023-05-20 03:23:52 +05:30 committed by GitHub
parent 14b840e96e
commit 522e2dcb76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
'use strict'
const { TextEncoder, TextDecoder } = require('util');
const useLegacyCrypto = parseInt(process.versions && process.versions.node && process.versions.node.split('.')[0]) < 15
if (useLegacyCrypto) {
// We are on an old version of Node.js that requires legacy crypto utilities.