We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0c250a commit 0949a59Copy full SHA for 0949a59
bundler/modules/text-encoding-utf.cjs
@@ -52,8 +52,12 @@ TextEncoder.prototype.encode = function (str) {
52
return new Uint8Array(buf.buffer, buf.byteOffset, buf.length)
53
}
54
55
-TextEncoder.prototype.encodeInto = function () {
56
- throw new Error('not supported')
+TextEncoder.prototype.encodeInto = function (str, ua) {
+ if (!(ua instanceof Uint8Array)) throw new Error('second argument must be an Uint8Array')
57
+ const buf = Buffer.from(str)
58
+ if (ua.length < buf.length) throw new Error('Truncation not supported')
59
+ ua.set(buf)
60
+ return { read: str.length, written: buf.length }
61
62
63
function TextDecoder(encoding = UTF8, options = {}) {
0 commit comments