You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
506 B
17 lines
506 B
const SqliteToJson = require('sqlite-to-json');
|
|
const sqlite3 = require('sqlite3');
|
|
const exporter = new SqliteToJson({
|
|
client: new sqlite3.Database('./worldcup.db')
|
|
});
|
|
|
|
exporter.tables((err, tables) => {
|
|
errorHandler("Listing all tables.", err);
|
|
|
|
tables.forEach((table) => {
|
|
exporter.save(table, `./data/${table}.json`, errorHandler.bind(null,`Saving ${table}.`));
|
|
});
|
|
});
|
|
|
|
function errorHandler(msg, err) {
|
|
err ? console.error(`ERROR ${msg}:\n ${err}`) : console.log(msg);
|
|
}
|
|
|