(wasm) Treat arbitrary byte data as Uint8Array, instead of base64url marshalling.
This commit is contained in:
@@ -37,6 +37,19 @@ pub(crate) fn into_unchecked_string_array(items: Vec<String>) -> StringArray {
|
||||
.unchecked_into::<StringArray>() // TODO: can I do this a better way?
|
||||
}
|
||||
|
||||
#[wasm_bindgen]
|
||||
extern "C" {
|
||||
#[wasm_bindgen(typescript_type = "Uint8Array[]")]
|
||||
pub type Uint8ArrayArray;
|
||||
}
|
||||
/// Convert a `Vec<Uint8Array>` into a `js_sys::Array` with the type of `Uint8Array[]`
|
||||
pub(crate) fn into_unchecked_uint8array_array(items: Vec<Uint8Array>) -> Uint8ArrayArray {
|
||||
items
|
||||
.iter()
|
||||
.collect::<js_sys::Array>()
|
||||
.unchecked_into::<Uint8ArrayArray>() // TODO: can I do this a better way?
|
||||
}
|
||||
|
||||
/// Convert a StringArray (`js_sys::Array` with the type of `string[]`) into `Vec<String>`
|
||||
pub(crate) fn into_unchecked_string_vec(items: StringArray) -> Vec<String> {
|
||||
items
|
||||
|
||||
Reference in New Issue
Block a user