[sword-devel] HTML5 File API and SWORD modules

Stephan info at tetzels.de
Tue May 7 07:58:48 MST 2013

Sorry for reopen this thread...

After reading sword module files with server-side Javascript 
(https://github.com/zefanja/node-swordjs) I was able to read the ztext 
modules in the browser. I've used the FileAPI to read a *.bzz file (or 
better only a part of it) and decompress the ArrayBuffer/Uint8Array with 
zlib.js (https://github.com/imaya/zlib.js) to get uncompressed data.

I don't like the idea of rewriting everything from scratch, but 
currently there is no way to use the c++ code for a javascript 
implentation. I've tried to port the SWFilter part with Emscripten but 
without success. I think it is possible to port the simple filters that 
only have a processText() function, but the OSIS filters have to many 
dependencies (like SWModule, SWMgr, VerseKey, ...).

Another problem is (like mentioned before) how to store the module files 
in a browser. There is the FileSystem API, but it is Chrome-only. 
IndexedDB is implemented in Firefox, Chrome and IE10, but you can store 
file blobs only in Firefox and not in the other browsers. There is a 
FileSystem API wrapper for Firefox 
(https://github.com/ebidel/idb.filesystem.js) but with some limitations.

What do you think about a HTML5/JS implemantion in general? How can we 
use as much as possible code of the current library so that we don't 
have to rewrite everything from scratch?

I will uploaded my code as soon as I cleaned it up.


More information about the sword-devel mailing list