MCPcopy Index your code
hub / github.com/darkreader/darkreader / httpsRequest

Function httpsRequest

tasks/utils.js:184–201  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

182 * @returns {Promise<{buffer(): Buffer; text(encoding?: BufferEncoding): string; type(): string}>}
183 */
184export function httpsRequest(url) {
185 return new Promise((resolve) => {
186 /** @type {Uint8Array[]} */
187 const data = [];
188 https.get(url, (response) => {
189 response
190 .on('data', (chunk) => data.push(chunk))
191 .on('end', () => {
192 const buffer = Buffer.concat(data);
193 resolve({
194 buffer: () => buffer,
195 text: (encoding = 'utf8') => buffer.toString(encoding),
196 type: () => response.headers['content-type'] || '',
197 });
198 });
199 });
200 });
201}

Callers 1

translateFunction · 0.90

Calls 1

getMethod · 0.65

Tested by

no test coverage detected