下载phonegap中的资源包
我编写了一个phonegap应用程序,它从JSON文件获取数据,该文件提供要显示的文本和Amazon S3托管图像的路径,因为该应用程序在没有信号的区域中使用,很多时候它必须能够下载和缓存所有内容。
有没有比单独请求每个图像然后保存更优雅的方法来下载图像包?理想情况下,我想下载一个包(例如 zip 文件),然后在下载后将其解压到手机文件系统,因为逐个图像执行此操作意味着大量单独的 HTTP 请求,这会带来严重的延迟。
I've written a phonegap App which gets its data from a JSON file which provides text to display and paths Amazon S3 hosted images, because the App is used in areas without signal a lot of the time it has to be able to download and Cache all content.
Is there a more elegant way to download packages of images than requesting every image individually and then saving it? Ideally I'd like to download a single package (e.g. a zip file) and then extract it to the phones file system after download as doing it image by image means a lot of individual HTTP requests which introduces substantial delays.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,您可以使用 FileTransfer 类将 .zip 下载到您的 SD 卡,然后您必须编写一个插件来进行解压缩。幸运的是,Android 包含 java.util.zip 包,因此您无需导入任何其他库即可解压缩。
Well you would use the FileTransfer class to download the .zip to your sdcard then you'd have to write a plugin to do the unzip. Luckily Android includes the java.util.zip package so you wouldn't have to import any additional libraries in order to do an unzip.