/
Stameskaaa
/
Server
Обзор
Документация
Войти
/
Stameskaaa
/
Server
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
node_modules/mongodb/lib/client-side-encryption/providers/utils.js
35 строк
1 KB
Stameskaaa
first
19 июн 2024, 15:02
19 июн 2024, 15:02
ac1472e
Код
Авторство
О чём код?
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.get = void 0; const http = require("http"); const timers_1 = require("timers"); const errors_1 = require("../errors"); /** * @internal */ function get(url, options = {}) { return new Promise((resolve, reject) => { /* eslint-disable prefer-const */ let timeoutId; const request = http .get(url, options, response => { response.setEncoding('utf8'); let body = ''; response.on('data', chunk => (body += chunk)); response.on('end', () => { (0, timers_1.clearTimeout)(timeoutId); resolve({ status: response.statusCode, body }); }); }) .on('error', error => { (0, timers_1.clearTimeout)(timeoutId); reject(error); }) .end(); timeoutId = (0, timers_1.setTimeout)(() => { request.destroy(new errors_1.MongoCryptKMSRequestNetworkTimeoutError(`request timed out after 10 seconds`)); }, 10000); }); } exports.get = get; //# sourceMappingURL=utils.js.map