MCPcopy Create free account
hub / github.com/apify/impit / decode_buffer

Method decode_buffer

impit-node/src/response.rs:176–190  ·  view source on GitHub ↗
(&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

Calls 2

decodeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected