是nativescript中的新手,我想知道如何将.db文件编码为base 64并发送到服务器。我尝试过的内容如下所列
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 -------=--------");
}
我得到的输出是该abc.db文件的base64编码路径。 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 /显影剂/ CoreSimulator /设备/ C9C54E5A-643C-4A63-AB3D-5CB0F82CCAB5 /数据/容器/数据/应用/ D0685AB3-A52D-42B0-9584-B2647B3A7C32 /文档/ vms.db