Ok. I've compiled libzip.
I can read entries names but how can I pass buffer to Javascript for this C
function?
int zipG(const char* zip_file_name, char* ZipBuf2) {
int v1=zip_entry_opencasesensitive(gloablZip, zip_file_name);
cout << v1 << endl;
zip_entry_read(gloablZip, (void**)&ZipBuf2, &ZipBuf_size);
cout << ZipBuf_size << endl;
return 0;
}
in JS:
var myBuffer= cArray8(32000)
Module.ccall('zipG', 'number', ['string','number'],
['model.dat',myBuffer.offset]);
function cArray8(size) {
var offset = Module._malloc(size * 1);
Module.HEAP8.set(new Uint8Array(size), offset / 1);
return {
"data": Module.HEAP8.subarray(offset / 1, offset / 1 + size),
"offset": offset
}
};
Il giorno gio 31 ott 2024 alle ore 21:25 Brooke Vibber <[email protected]> ha
scritto:
> On Thu, Oct 31, 2024 at 11:44 AM Mercp <[email protected]> wrote:
>
>> Thank you. So zlib can't access zip file entries? Has libzip never been
>> linked?
>>
> zlib handles gzip files: https://zlib.net/
> libzip handles zip files: https://libzip.org/
>
> You can probably compile libzip fairly straightforwardly, then link it
> into your project just as you would any other library.
>
> -- brooke
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "emscripten-discuss" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/emscripten-discuss/foCw8MVFchE/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTn_w_ZejcZmZQheFjOSo4UZo7p8UYHQSyP8UitUubON9Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/emscripten-discuss/CAFnWYTn_w_ZejcZmZQheFjOSo4UZo7p8UYHQSyP8UitUubON9Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/emscripten-discuss/CACcE5fn_L3AZK3hNipgMM8je02HfxEpK%2Bm%3DMiN6KOFF0sYA0yQ%40mail.gmail.com.