Open camhart opened 4 years ago
I figured out how to pass it as base64 encoded string. Still can't figure out how to just pass it as a raw byte array or buffer.
let base64Data = self.screenshotData.base64EncodedString()
status = napi_set_named_property(env, result, "data", try base64Data.napiValue(env))
guard status == napi_ok else { throw NAPI.Error(status) }
The best way forward would probably be to make Data
conform to NAPI.ValueConvertible
, and have it use the NAPI apis for creating Uint8Arrays. I don't have time to fix that right now, but would be happy to accept a PR 👍
I'm new to swift, c, c++, and napi. So forgive the noobyness. I need to pass an object containing a Data (https://developer.apple.com/documentation/foundation/data) object from swift to nodejs (passing image data).
End goal would be Data on nodejs side as a byte array/buffer.
Extensions: