extract-android-device-names.js 493 B

12345678910111213141516171819
  1. const csv = require('csv-parser');
  2. const fs = require('node:fs');
  3. const transformResults = res => {
  4. const deviceMapping = {};
  5. res.forEach(({name, model}) => {
  6. if (name && model) {
  7. deviceMapping[model] = name;
  8. }
  9. });
  10. return deviceMapping;
  11. };
  12. const results = [];
  13. fs.createReadStream('supported_devices.csv')
  14. .pipe(csv())
  15. .on('data', data => results.push(data))
  16. .on('end', () => {
  17. fs.writeFileSync('devices.json', JSON.stringify(transformResults(results)));
  18. });