views:

341

answers:

2

Hi! Is there an as3 solution for extracting file content from uncompressed tar files around? / Jonas

A: 

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:

<files>
   <file url="/images/icon.png" id="icon" />
...
</files>

Load that with an URLLoader, loop through the nodes, add the items to bulk loader and start the whole loading process.

George Profenza
Hi George!I'm struggling a lot with the nochump and fzip libraries, and the need for Adler32 checksums when running in browser (Flash Player) causes problems for me.As my file contents are already compressed (mp3s and pngs) there's no need for further compression/decompression... So a simple tar solution would suite my needs!
Cambiata
I have edited my answer.
George Profenza
Hello again, George!I have been using BulkLoader, but in the current project each example contains so many differentiated file objects that have to be processed and rearranged, and I'm looking for a chain of solutions (php on the server, flex/air on the client) to keep "all files in one". Maybe Edwin Vanrijkom's FAR (http://code.google.com/p/vanrijkom-flashlibs/) will be an alternative... I would prefer an uncompressed alternative/option though, because I use full length mp3 files, and the cost of compress/uncompress takes more than it gives...
Cambiata
Hmmm, tough one. I guess at this point the answer to your original question is no, as far as I know. No TAR AS3 API :( ...yet.
George Profenza
I'm trying out the FAR solution right now, and it works well! Fast enough both compressed and uncompressed. The only problem is running the cli tool for compiling FARs on linux, wich gives an Gtk-WARNING...
Cambiata
+3  A: 

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 package neko 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 ...


back2dos
Hi Back2dos! Haxe seems really interesting! Could be used for code generation on both as3 and php, right..? I'm dreaming of getting out of php hell... :-)
Cambiata