Skip to content

Instantly share code, notes, and snippets.

@saul-mtz
Last active September 21, 2017 21:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saul-mtz/a6a09fca22021195d012f732fb959e2f to your computer and use it in GitHub Desktop.
Save saul-mtz/a6a09fca22021195d012f732fb959e2f to your computer and use it in GitHub Desktop.
Importa el contenido de http://comoayudar.mx y lo guarda en un archivo llamado cards.json
/**
* @author: saul.mtz.v
*
* Importa el contenido de http://comoayudar.mx
* y lo guarda en un archivo llamado cards.json
*
* Ejectuar:
* node cardsToJSON.js
*/
const http = require('https');
const fs = require('fs');
const url = 'https://raw.githubusercontent.com/eldelentes/comoayudarmx/master/cards.js';
const fileName = 'cards.json';
var script = '';
http.get(url, function(res) {
res.on('data', function(d) {
script += d.toString();
});
}).on('close', function(e) {
const cards = eval(script);
fs.writeFileSync(fileName, JSON.stringify(cards, null, 2));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment