Method
decode_buffer
(&self, buffer: BufferSlice)
Source from the content-addressed store, hash-verified
| 174 | /// @ignore |
| 175 | #[napi(ts_return_type = "string")] |
| 176 | pub fn decode_buffer(&self, buffer: BufferSlice) -> Result<String> { |
| 177 | let encoding = self |
| 178 | .headers |
| 179 | .get("content-type") |
| 180 | .and_then(|content_type| ContentType::from(content_type).ok()); |
| 181 | |
| 182 | let string = decode( |
| 183 | &buffer, |
| 184 | match encoding { |
| 185 | Some(encoding) => encoding.into(), |
| 186 | None => None, |
| 187 | }, |
| 188 | ); |
| 189 | Ok(string) |
| 190 | } |
| 191 | |
| 192 | /// Returns the response body as an `ArrayBuffer`. |
| 193 | /// |
Callers
nothing calls this directly
Tested by
no test coverage detected