@@ -566,50 +566,6 @@ void StringSlice(const FunctionCallbackInfo<Value>& args) {
566566 args.GetReturnValue ().Set (ret);
567567}
568568
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-
613569// bytesCopied = copy(buffer, target[, targetStart][, sourceStart][, sourceEnd])
614570void Copy (const FunctionCallbackInfo<Value> &args) {
615571 Environment* env = Environment::GetCurrent (args);
@@ -1259,7 +1215,6 @@ void Initialize(Local<Object> target,
12591215
12601216 SetMethod (context, target, " setBufferPrototype" , SetBufferPrototype);
12611217 SetMethodNoSideEffect (context, target, " createFromString" , CreateFromString);
1262- SetMethodNoSideEffect (context, target, " decodeUTF8" , DecodeUTF8);
12631218
12641219 SetMethodNoSideEffect (context, target, " byteLengthUtf8" , ByteLengthUtf8);
12651220 SetMethod (context, target, " copy" , Copy);
@@ -1314,7 +1269,6 @@ void Initialize(Local<Object> target,
13141269void RegisterExternalReferences (ExternalReferenceRegistry* registry) {
13151270 registry->Register (SetBufferPrototype);
13161271 registry->Register (CreateFromString);
1317- registry->Register (DecodeUTF8);
13181272
13191273 registry->Register (ByteLengthUtf8);
13201274 registry->Register (Copy);
0 commit comments