Flash 10:如何将数据流式传输到本地文件?
我需要 Adobe AIR 中的 FileStream 类之类的东西,但需要在 Flash Player 中工作。 我知道有 FileReference#save(),但它只能一次保存整个文件,如果要保存的数据大小大于可用内存,则不起作用...... 是否真的无法将数据流式传输到本地文件以避免将整个数据保留在内存中? 或者也许可以将数据附加到本地文件,而无需先将整个文件读入内存?
我非常需要这个! 谢谢!
I need something like FileStream class in Adobe AIR, but needs to work in Flash Player.
I know there is FileReference#save(), but it can only save the whole file at once, which does not work if the size of the data to be saved is larger than the available memory...
Is it really not possible to stream data to a local file to avoid keeping the whole data in the memory?
Or maybe it is possible to append data to a local file without first reading the whole file into memory?
I need this badly!
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你运气不好。 安全限制不允许这种情况在 AIR 应用程序上下文之外发生。
You're out of luck. Security restrictions don't allow this to happen outside the context of an AIR application.
如果您有要访问的服务器,您可以通过服务器传递数据来实现。
使用 FileReference.save() 并点击服务器上的某个 URL。 然后,开始将要保存的数据流式传输到服务器,然后让服务器将其重定向到 Flash 客户端。 您需要在服务器上编写一些自定义处理,并且它不会像在本地保存一样快,但这可能是您能够做到这一点的唯一方法。
If you have a server to hit you could sort of do it by passing the data through the server.
Use FileReference.save() and hit some URL on your server. Then, start streaming the data you want saved to the server, and then have the server just redirect that to the flash client. You'll need to write some custom handling of things on the server, and it won't be nearly as fast as just saving locally, but it's probably the only way you'll be able to do it.