Skip to main content

value_to_bytes

Function value_to_bytes 

Source
pub fn value_to_bytes<'js>(
    ctx: &Ctx<'js>,
    value: &Value<'js>,
    encoding: Option<&str>,
) -> Result<Vec<u8>>
Expand description

Node’s Buffer.from lowering: a string in encoding, an array of byte values, another Buffer, or any BufferSource.

§Errors

A TypeError for an unsupported encoding or a value that is none of those.