MCPcopy Create free account
hub / github.com/GNOME/gjs / TextEncoder

Class TextEncoder

modules/esm/_encoding/encoding.js:136–156  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136class TextEncoder {
137 get [Symbol.toStringTag]() {
138 return 'TextEncoder';
139 }
140
141 get encoding() {
142 return 'utf-8';
143 }
144
145 encode(input = '') {
146 const Encoding = import.meta.importSync('_encodingNative');
147 // The TextEncoder specification only allows for UTF-8 encoding.
148 return Encoding.encode(`${input}`, 'utf-8');
149 }
150
151 encodeInto(input = '', output = new Uint8Array()) {
152 const Encoding = import.meta.importSync('_encodingNative');
153 // The TextEncoder specification only allows for UTF-8 encoding.
154 return Encoding.encodeInto(`${input}`, output);
155 }
156}
157
158Object.defineProperty(globalThis, 'TextEncoder', {
159 configurable: false,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected