将下载的文件保存在www Folder ionic 2中 [英] Save Downloaded File in www Folder ionic 2

查看:86
本文介绍了将下载的文件保存在www Folder ionic 2中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序,用户需要使用大型数据库。而不是让用户下载数据并在客户端上填充SQLite数据库(这需要很长时间),我希望我可以使用可下载的预先填充的数据库。

I'm creating an app where users need to work with large databases. Rather than having the users download the data and populate an SQLite database on the client (which would take a long time), I'm hoping I can use downloadable, pre-populated databases.

我找到了 cordova-sqlite-ext ,它允许使用pre-填充的数据库,但SQLite文件必须位于 www 文件夹中才能生效。实际上是否可以将文件下载到Ionic / Cordova中的文件夹(在非root设备上)?

I found cordova-sqlite-ext, which allows working with pre-populated databases, but SQLite files must be located in the www folder for this to work. Is it actually possible to download files to this folder in Ionic/Cordova (on non-rooted devices)?

推荐答案

总是好的练习将文件存储在应用程序的目录中。检查我的评论,看看它是否对你有帮助:

It's always good practise to store your files in app's directory. Check this comment of mine and see if it helps you:

https://github.com/driftyco/ionic-native/issues/881#issuecomment-270832521

我需要下载一个zip文件(包含sqlite文件),解压缩文件,将文件存储在应用程序的目录中并查询数据库。我能够使用插件实现它并且工作得很好。

I had a requirement of downloading a zip file(with sqlite file in it), unzip the file, store the file in app's directory and query the DB. I was able to achieve it using plugins and works quite well.

这篇关于将下载的文件保存在www Folder ionic 2中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆