使用PhoneGap的下载文件的下载文件夹的ios / android的文件夹、文件、PhoneGap、ios

2023-09-07 22:47:15 作者:烟瘾是无形的毒i

我收到从返回的文件以二进制或Base64 Web服务的JSON响应。我想这个文件保存到文件系统。

I am getting a JSON response from a web service that returns a file in either binary or base64 . I want to save this file to the fileSystem.

我想知道理想的(默认/行业标准)的位置,为IOS / Android上的文件系统上下载这些文件。 如果没有理想的地方,我想将它们保存在默认的下载文件夹IOS / Android的。那么我想知道什么是这些文件夹的位置。

我也想知道我需要使用哪些方法在PhoneGap的FileAPi?

I also wanted to know which methods in the Phonegap FileAPi i need to use?

推荐答案

没有用于下载没有默认的地方

There is no default place for downloads

在看的PhoneGap的文件API 了解更多信息

Look the phonegap's File API for more info.

使用PhoneGap的,你可以去申请临时或永久的文件系统

With phonegap you can request de temporary or the permanent file system

window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail);

在iOS持久性回报的Documents目录,并且临时返回缓存目录 在Android持久性回报的SD卡或手机内存和临时返回​​数据文件夹内的文件夹中。根

on iOS PERSISTENT returns the Documents directory, and the TEMPORARY returns the Caches directory on Android PERSISTENT returns the root of the SD card or phone memory, and TEMPORARY returns a folder inside the data folder.

要下载的文件,使用文件传输