Encode sqlite database to base64, nativescript


#1

Am newbie in nativescript, i would like to know how to encode the .db file to base 64 and send to server. What i was tried is listed below

if (sqlite.exists(“abc.db”)) {
let documents = fs.knownFolders.documents();
let path = fs.path.join(documents.path, “abc.db”);
var file = documents.getFile(path);
var content = file.readTextSync();
console.log("content: " + content);
}else{
console.log(“vms db not exist -------=--------”);
}
The output what i have got is the base64 encoded path of that abc.db file. ie /Users/abcuser/Library/Developer/CoreSimulator/Devices/C9C54E5A-643C-4A63-AB3D-5CB0F82CCAB5/data/Containers/Data/Application/D0685AB3-A52D-42B0-9584-B2647B3A7C32/Documents/Users/abcuser/Library/Developer/CoreSimulator/Devices/C9C54E5A-643C-4A63-AB3D-5CB0F82CCAB5/data/Containers/Data/Application/D0685AB3-A52D-42B0-9584-B2647B3A7C32/Documents/vms.db