Actionscript 3:读取 TAR 档案的解决方案?
是否有 as3 解决方案用于从未压缩的 tar 文件中提取文件内容? / 乔纳斯
Is there an as3 solution for extracting file content from uncompressed tar files around?
/ Jonas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试 hxformat,这是一个支持多种格式的 Haxe 库,包括
tar< /code> ...您将需要 Haxe ,或者使用 swc 输出 或 ActionScript 3 生成 ...
一点旁注:就个人而言,我建议无论如何从 AS3 切换到 Haxe ...Haxe 也可以转换为 PHP,您正在使用它同样,这样你就可以方便地在客户端和服务器上使用它...
编辑:是的,实际上 Haxe 可以直接编译为 swfs,从而产生比 as3 更快的字节码,但你始终可以使用 as3gen ,如果你想... Haxe/PHP 也很酷,因为它生成 php 代码,但你可以使用 Haxe,这意味着它是严格类型的,并且整个 API 以一致且良好的 OO 方式公开。 .. Haxe 甚至不允许顶级函数...但是如果你真的需要它来做一些肮脏的事情,当然你可以使用内联 php ...
API 还包含许多有用的东西,如 SPOD 层(php.db 包)用于干净、简单的数据库访问...本教程适用于 neko,但这并不重要,因为实际上 Haxe/PHP 和 Haxe/Neko 标准 API 是完全兼容的……这也意味着,从 php 移植到 neko(在某些情况下明显更快、更高效)通常是一个问题使用编译器指令将包
php
重新映射为包neko
... Haxe 是利用 PHP 随处部署优势的解决方案,同时使用一种非常出色的语言...此外,Haxe 比 AS3 和 PHP 更具表现力...它具有带参数的枚举、泛型、结构子类型等...由于它与平台无关,因此存在一些缺点,但这些缺点只会发生如果你的代码不是严格类型的......听起来有很多类型,但是编译器推断出很多类型,所以通过初始化一个变量,它已经是严格类型的......:)
哦,如果你真的想使用 Haxe ,看看haxelib,它有很多很酷的库......
Try hxformat, a Haxe-library supporting a multitude of formats, including
tar
... you will need Haxe for that, either using swc output or ActionScript 3 generation ...A little side note: personally, I'd recommend switching from AS3 to Haxe anyway ... Haxe can also be translated to PHP, which you are using as well, so you could conveniently use it on both client and server ...
Edit: yes, actually Haxe can be compiled to swfs directly, resulting in faster bytecode than as3, but you can always use as3gen, if you want to ... Haxe/PHP is also very cool, because it produces php code, but you can use Haxe, which implies, that it's strictly typed and that the whole API is exposed in a consistent and nice OO way ... Haxe does not even allow top level functions ... but if your really need it to do some dirty stuff, you can use inline php of course ...
the API also contains many helpful things, as the SPOD layer (package php.db) for clean and simple database access ... the tutorial is for neko, but that does not matter, because actually the Haxe/PHP and Haxe/Neko standard APIs are fully compatible ... this also implies, that porting from php to neko (which significantly faster and more effictient in some cases) usually is a matter of remaping package
php
to packageneko
using a compiler directive ... Haxe is THE solution for using the deploy-anywhere advantages of PHP, whilst using a really great language ...Also Haxe is much more expressive than both AS3 and PHP ... it has enums with parameters, generics, structural subtyping, etc. ... there are some drawbacks, due to the fact that it is platform independant, but these will only occur if your code is not strictly typed ... sounds like a lot of typing, but the compiler infers many types, so by initializing a variable, it is already strictly typed ... :)
Oh, and if you really want to use Haxe, have a look at haxelib, which has many cool libraries ...
我还没有见过 as3 tar 库。不过,也有 zip 库,例如 nochump 的 zip 和 fzip。
解决方法是告诉服务器将请求的 tar 制作成 zip,加载到闪存中,一旦获得内容,就告诉服务器打包该 zip。如果您有 as3 的 tar 库,那么它会很长并且有不必要的步骤。
另一个选择显然是创建您自己的 tar 库。
我使用了 nochump 的 zip 并且没有任何问题,但是由于您不需要压缩,这将使整个事情无缘无故地变得复杂。完全不使用任何压缩,也不将整个内容打包到 tar 中怎么样?尝试批量加载器:。看起来很适合你的需求。如果您不想手动添加所有文件,您可能可以在服务器上生成一个 xml,通用的内容如下:
使用 URLLoader 加载该文件,循环遍历节点,将项目添加到批量加载器并启动整个加载过程。
I haven't seen an as3 tar library. There are zip libraries out there though, like nochump's zip and fzip.
A workaround would be to tell the server to make the requested tar into a zip, load into flash, and once you have the content, tell the server to whipe that zip. It's a big long and has unnecesary steps if you had a tar library for as3.
The other option would be obviously to make your own tar library.
I have used nochump's zip and had no problems, but since you need no compression this would make the whole thing complex for no reason. How about not using any compression at all, and not package the whole thing into a tar. Try Bulk Loader:. Seems to fit your needs. If you don't feel like manually adding all the files manually you could probably generate an xml on the server, something generic like:
Load that with an URLLoader, loop through the nodes, add the items to bulk loader and start the whole loading process.