MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / toUtf16LeBase64

Function toUtf16LeBase64

src/utils/powershell/parser.ts:669–680  ·  view source on GitHub ↗

* Base64-encode a string as UTF-16LE, which is the encoding required by * PowerShell's -EncodedCommand parameter.

(text: string)

Source from the content-addressed store, hash-verified

667 * PowerShell's -EncodedCommand parameter.
668 */
669function toUtf16LeBase64(text: string): string {
670 if (typeof Buffer !== 'undefined') {
671 return Buffer.from(text, 'utf16le').toString('base64')
672 }
673 // Fallback for non-Node environments
674 const bytes: number[] = []
675 for (let i = 0; i < text.length; i++) {
676 const code = text.charCodeAt(i)
677 bytes.push(code & 0xff, (code >> 8) & 0xff)
678 }
679 return btoa(bytes.map(b => String.fromCharCode(b)).join(''))
680}
681
682/**
683 * Build the full PowerShell script that parses a command.

Callers 1

Calls 2

toStringMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected