The version of the punycode module bundled in Node.js is being deprecated. Users currently depending on theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/nodejs/node/llms.txt
Use this file to discover all available pages before exploring further.
punycode module should switch to using the userland-provided Punycode.js module instead. For punycode-based URL encoding, see url.domainToASCII() or the WHATWG URL API.
Overview
Thepunycode module is a bundled version of the Punycode.js module. It can be accessed using:
'example' is '例'. The Internationalized Domain Name '例.com' (equivalent to 'example.com') is represented by Punycode as the ASCII string 'xn--fsq.com'.
Methods
punycode.decode(string)
Converts a Punycode string of ASCII-only characters to the equivalent string of Unicode codepoints. Parameters:string(string) - The Punycode string to decode
punycode.encode(string)
Converts a string of Unicode codepoints to a Punycode string of ASCII-only characters. Parameters:string(string) - The Unicode string to encode
punycode.toASCII(domain)
Converts a Unicode string representing an Internationalized Domain Name to Punycode. Only the non-ASCII parts of the domain name will be converted. Callingpunycode.toASCII() on a string that already only contains ASCII characters will have no effect.
Parameters:
domain(string) - The domain name to convert
punycode.toUnicode(domain)
Converts a string representing a domain name containing Punycode encoded characters into Unicode. Only the Punycode encoded parts of the domain name are converted. Parameters:domain(string) - The Punycode domain name to convert
UCS-2 Encoding
punycode.ucs2.decode(string)
Returns an array containing the numeric codepoint values of each Unicode symbol in the string. Parameters:string(string) - The string to decode
punycode.ucs2.encode(codePoints)
Returns a string based on an array of numeric code point values. Parameters:codePoints(integer[]) - Array of numeric code points