Method
end
(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>)
Source from the content-addressed store, hash-verified
| 237 | encoder, |
| 238 | buffer: Vec::new(), |
| 239 | buffered_bytes: 0, |
| 240 | missing_bytes: 0, |
| 241 | }) |
| 242 | } |
| 243 | |
| 244 | #[qjs(get)] |
| 245 | pub fn encoding(&self) -> &str { |
| 246 | self.encoder.as_label() |
| 247 | } |
| 248 | |
| 249 | pub fn end(&mut self, ctx: Ctx<'_>, buffer: Opt<ArrayBufferView<'_>>) -> Result<String> { |
| 250 | let output = if let Some(data) = buffer.0.as_ref().and_then(|b| b.as_bytes()) { |
| 251 | Some(self.decode_data(&ctx, data)?) |
| 252 | } else { |
| 253 | None |
| 254 | }; |
| 255 | |
| 256 | let flush = self.flush(&ctx)?; |