diff --git a/crates/napi/src/bindgen_runtime/js_values/buffer.rs b/crates/napi/src/bindgen_runtime/js_values/buffer.rs index d5857ec6..2cc6bdf3 100644 --- a/crates/napi/src/bindgen_runtime/js_values/buffer.rs +++ b/crates/napi/src/bindgen_runtime/js_values/buffer.rs @@ -234,6 +234,12 @@ impl From<&[u8]> for Buffer { } } +impl From for Buffer { + fn from(inner: String) -> Self { + Buffer::from(inner.into_bytes()) + } +} + impl AsRef<[u8]> for Buffer { fn as_ref(&self) -> &[u8] { // SAFETY: the pointer is guaranteed to be non-null, and guaranteed to be valid if `len` is not 0.