4 key: /.*Key>(.*)<\/Key.*/,
5 generation: /.*Generation>(.*)<\/Generation.*/,
6 metaGeneration: /.*MetaGeneration>(.*)<\/MetaGeneration.*/,
7 lastModified: /.*LastModified>(.*)<\/LastModified.*/,
8 etag: /.*ETag>(.*)<\/ETag.*/,
9 size: /.*Size>(.*)<\/Size.*/
11 var baseUrl = 'https://chromedriver.storage.googleapis.com';
13 module.exports = function (request) {
21 url: 'https://chromedriver.storage.googleapis.com/',
24 .then(function (resp) {
26 var groups = body.split(/<\/?Contents>/g);
27 // get rid of leading and trailing junk
30 var metas = groups.map(function (group) {
32 key: group.replace(matchers.key, '$1'),
33 //generation: group.replace(matchers.generation, '$1'),
34 //metaGeneration: group.replace(matchers.metaGeneration, '$1'),
35 lastModified: group.replace(matchers.lastModified, '$1')
36 //etag: group.replace(matchers.etag, '$1'),
37 //size: group.replace(matchers.size, '$1')
40 all.download = baseUrl + '/{{ download }}';
41 metas.forEach(function (asset) {
42 if (!asset.key.includes('chromedriver')) {
43 // skip the indexes, images, etc
47 var osname = asset.key.replace(/.*(win|mac|linux)/, '$1');
49 if (asset.key.includes('linux')) {
51 } else if (asset.key.includes('mac64')) {
53 if (asset.key.includes('_m1.')) {
56 } else if (asset.key.includes('win')) {
61 // 87.0.4280.88/chromedriver_win32.zip => 87.0.4280.88
62 version: asset.key.replace(/(.*)\/.*/, '$1'),
65 date: asset.lastModified.replace(/T.*/, '$1'),
68 hash: '-', // not sure about including etag as hash yet
74 all.releases.sort(function (a, b) {
75 return new Date(b.date).valueOf() - new Date(a.date).valueOf();
81 if (module === require.main) {
82 module.exports(require('@root/request')).then(function (all) {
83 all = require('../_webi/normalize.js')(all);
84 // just select the latest 5 for demonstration
85 all.releases = all.releases.slice(-20);
86 console.info(JSON.stringify(all, null, 2));