gpt4 book ai didi

javascript - 使用 Phonegap 的文件 API 修改应用程序 Assets

转载 作者:太空狗 更新时间:2023-10-29 13:28:52 24 4
gpt4 key购买 nike

我用 html5 开发了一个 phonegap 应用程序一个月。我使用 File API 处理离线 JSON 文件。
看来我存储的 JSON 文件自动保存在 /mnt/sdcard/ 上。

问题是,我发现自己要为每个我想要的文件处理 3 个文件。
1 st 与我的应用打包的文件 (js/products.js)
2 向我发送更新的远程文件 (http://website/remote_products.js)
3 我用远程数据更新 sdcard 上的本地文件。 (/mnt/sdcard/updated-products.js)

是否有可能 - 而不是保存在 sdcard 上 - 使用文件 API 更新我的应用程序的 Assets ?
或者在我的应用 Assets 文件夹中创建一个新文件?

(与我的应用程序一起打包的 JSON 文件。在 js/products.js 中找到)

如果是,请问如何?

谢谢

最佳答案

遗憾的是,您无法使用文件 API 修改 /android_assets/www 中的文件。

请参阅由一位 PhoneGap Android 开发人员回答的稍微不同的问题的答案:https://stackoverflow.com/a/8966227/878602

"You can't do what you want to do. The files in the assets directory are not technically on the file system so they are not accessible via the File API. This means calling window. resolveLocalFileSystemURI() will not return you a FileEntry."

关于javascript - 使用 Phonegap 的文件 API 修改应用程序 Assets ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9392150/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com