Method
from_encoding
(
ctx: &Ctx<'js>,
mut bytes: Vec<u8>,
encoding: Option<String>,
)
Source from the content-addressed store, hash-verified
| 76 | } |
| 77 | |
| 78 | fn from_encoding( |
| 79 | ctx: &Ctx<'js>, |
| 80 | mut bytes: Vec<u8>, |
| 81 | encoding: Option<String>, |
| 82 | ) -> Result<Value<'js>> { |
| 83 | if let Some(encoding) = encoding { |
| 84 | let encoder = Encoder::from_str(&encoding).or_throw(ctx)?; |
| 85 | bytes = encoder.decode(bytes).or_throw(ctx)?; |
| 86 | } |
| 87 | Buffer(bytes).into_js(ctx) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // Static Methods |
Callers
nothing calls this directly
Tested by
no test coverage detected