mirror of
https://github.com/uNetworking/uWebSockets.js.git
synced 2025-12-19 18:10:26 -05:00
getParts needs to copy the parts until a better interface can replace this
This commit is contained in:
@@ -74,7 +74,7 @@ void uWS_getParts(const FunctionCallbackInfo<Value> &args) {
|
|||||||
|
|
||||||
std::string_view part = optionalPart.value();
|
std::string_view part = optionalPart.value();
|
||||||
|
|
||||||
Local<ArrayBuffer> partArrayBuffer = ArrayBuffer_New(isolate, (void *) part.data(), part.length());
|
Local<ArrayBuffer> partArrayBuffer = ArrayBuffer_NewCopy(isolate, (void *) part.data(), part.length());
|
||||||
/* Map is 30% faster in this case, but a static Object could be faster still */
|
/* Map is 30% faster in this case, but a static Object could be faster still */
|
||||||
Local<Object> partMap = Object::New(isolate);
|
Local<Object> partMap = Object::New(isolate);
|
||||||
partMap->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "data", NewStringType::kNormal).ToLocalChecked(), partArrayBuffer).IsNothing();
|
partMap->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "data", NewStringType::kNormal).ToLocalChecked(), partArrayBuffer).IsNothing();
|
||||||
|
|||||||
Reference in New Issue
Block a user