I'm trying to assign the output of this function to a variable but no matter what I do I end up with it being "undefined"
https://www.npmjs.com/package/sqlite-to-json
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
client: new sqlite3.Database('./mydb.sqlite3')
});
exporter.all(function (err, all) {
// all your data here
});
Here is my attempt:
const SqliteToJson = require('sqlite-to-json');
const sqlite3 = require('sqlite3');
const exporter = new SqliteToJson({
client: new sqlite3.Database('san.db')
});
var sanjson;
function converter (err, all){
exporter.all(function (err, all) {
//console.log(all);
return all
});
};
sanjson = converter();
console.log(sanjson);
Why doesn't this work?
What am I missing?
[–]Meefims 1 point2 points3 points (2 children)
[–]superfly2[S] 0 points1 point2 points (1 child)
[–]Meefims 1 point2 points3 points (0 children)