How to use the https.get function in https

To help you get started, we’ve selected a few https examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joe27g / EnhancedDiscord / plugins / direct_download.js View on Github external
function download (url, dest, cb) {
    const file = fs.createWriteStream(dest);
    http.get(url, function(response) {
        response.pipe(file);
        file.on('finish', function() {
            file.close(cb);
        });
    }).on('error', function(err) {
        fs.unlink(dest);
        if (cb) cb(err.message);
    });
}
github forcedotcom / salesforcedx-vscode / scripts / update-docs-externals.js View on Github external
const download = function(url, cb) {
  https
    .get(url, resp => {
      let data = '';
      resp.on('data', chunk => {
        data += chunk;
      });
      resp.on('end', () => {
        cb(null, JSON.parse(data));
      });
    })
    .on('error', err => {
      cb(err);
    });
};
github josa42 / coc-go / scripts / update-snippets.js View on Github external
const request = (url) => new Promise((resolve, reject) => {
  https
    .get(url, (resp) => {
      let data = ''
      resp.on('data', (chunk) => data += chunk)
      resp.on('end', () => resolve(JSON.parse(data)))
    })
    .on("error", (err) => reject(err))
})
github vaadin / platform / scripts / listBreakingChanges.js View on Github external
return new Promise((resolve, reject) => {
        https.get(url, (resp) => {
            let data = '';

            resp.on('data', (chunk) => {
                data += chunk;
            });

            resp.on('end', () => {
                resolve(data);
            });
        }).on("error", (err) => reject(err));
    });
}
github jgardella / compat / src / tableUpdater / createTable.js View on Github external
file.on('open', () => {
      https.get(url, (res) => {
        res.pipe(file)
        file.on('finish', () => {
          file.close(resolve)
        })
      })
        .on('error', (err) => {
          return reject(new Error('Failed to download file at ' + url + ' (' + err + ')'))
        })
    })
  })
github rem-bot-industries / rem-v2 / src / modules / audio / WolkeStream.js View on Github external
request(url, length) {
        const options = typeof url === 'string' ? URL.parse(url) : url;
        if (!options.headers) options.headers = {};
        if (length > 0) {
            options.headers.Range = `bytes=${length}-`;
        }
        if (options.protocol === 'https:') {
            let req = https.get(options, (res) => {
                this.processRes(req, res);
            });
        } else {
            let req = http.get(options, (res) => {
                this.processRes(req, res);
            });
        }
    }
github airmash-refugees / airmash-frontend / src / update-games-data.js View on Github external
function download(url, callback) {
    https.get(url, options, (res) => {
        let data = '';
        res.on('data', (chunk) => { data += chunk; });
        res.on('end', (e) => {
            if (e) throw e;
            callback(data);
        });
    });
}
github volkanceylan / Serene / Wizard / index.js View on Github external
function downloadHttps(url, cb) {
    var data = [], dataLen = 0; 
    https.get(url, function(res) {
        res.on('data', function(chunk) {
            data.push(chunk);
            dataLen += chunk.length;
        }).on('end', function() {
            var buf = Buffer.alloc(dataLen);
            for (var i=0, len = data.length, pos = 0; i < len; i++) { 
                data[i].copy(buf, pos); 
                pos += data[i].length; 
            }
            cb(buf);
        });
    });
}
github OpenSpace / OpenSpace / modules / spacecraftinstruments / scripts / crawl_rosetta_images / crawl_rosetta_images.js View on Github external
function getHttps(url, cb) {
  https.get(url, (res) => {
    let body = '';
    res.on('data', (d) => {
      body += d;
    });
    res.on('end', () => {
      cb(body);
    });
  });
}

https

https mediation

ISC
Latest version published 9 years ago

Package Health Score

59 / 100
Full package analysis