@@ -566,50 +566,6 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
566
566
args.GetReturnValue ().Set (ret);
567
567
}
568
568
569
- // Convert the input into an encoded string
570
- void DecodeUTF8 (const FunctionCallbackInfo<Value>& args) {
571
- Environment* env = Environment::GetCurrent (args); // list, flags
572
-
573
- CHECK_GE (args.Length (), 1 );
574
-
575
- if (!(args[0 ]->IsArrayBuffer () || args[0 ]->IsSharedArrayBuffer () ||
576
- args[0 ]->IsArrayBufferView ())) {
577
- return node::THROW_ERR_INVALID_ARG_TYPE (
578
- env->isolate (),
579
- " The \" list\" argument must be an instance of SharedArrayBuffer, "
580
- " ArrayBuffer or ArrayBufferView." );
581
- }
582
-
583
- ArrayBufferViewContents<char > buffer (args[0 ]);
584
-
585
- bool ignore_bom = args[1 ]->IsTrue ();
586
-
587
- const char * data = buffer.data ();
588
- size_t length = buffer.length ();
589
-
590
- if (!ignore_bom && length >= 3 ) {
591
- if (memcmp (data, " \xEF\xBB\xBF " , 3 ) == 0 ) {
592
- data += 3 ;
593
- length -= 3 ;
594
- }
595
- }
596
-
597
- if (length == 0 ) return args.GetReturnValue ().SetEmptyString ();
598
-
599
- Local<Value> error;
600
- MaybeLocal<Value> maybe_ret =
601
- StringBytes::Encode (env->isolate (), data, length, UTF8, &error);
602
- Local<Value> ret;
603
-
604
- if (!maybe_ret.ToLocal (&ret)) {
605
- CHECK (!error.IsEmpty ());
606
- env->isolate ()->ThrowException (error);
607
- return ;
608
- }
609
-
610
- args.GetReturnValue ().Set (ret);
611
- }
612
-
613
569
// bytesCopied = copy(buffer, target[, targetStart][, sourceStart][, sourceEnd])
614
570
void Copy (const FunctionCallbackInfo<Value> &args) {
615
571
Environment* env = Environment::GetCurrent (args);
@@ -1259,7 +1215,6 @@ void Initialize(Local<Object> target,
1259
1215
1260
1216
SetMethod (context, target, " setBufferPrototype" , SetBufferPrototype);
1261
1217
SetMethodNoSideEffect (context, target, " createFromString" , CreateFromString);
1262
- SetMethodNoSideEffect (context, target, " decodeUTF8" , DecodeUTF8);
1263
1218
1264
1219
SetMethodNoSideEffect (context, target, " byteLengthUtf8" , ByteLengthUtf8);
1265
1220
SetMethod (context, target, " copy" , Copy);
@@ -1314,7 +1269,6 @@ void Initialize(Local<Object> target,
1314
1269
void RegisterExternalReferences (ExternalReferenceRegistry* registry) {
1315
1270
registry->Register (SetBufferPrototype);
1316
1271
registry->Register (CreateFromString);
1317
- registry->Register (DecodeUTF8);
1318
1272
1319
1273
registry->Register (ByteLengthUtf8);
1320
1274
registry->Register (Copy);
0 commit comments