rawspeed won't let you extract the thumbnail. Also, the reason I suggested dcraw is because it's one C file and that makes things a lot easier, especially when compiling to javascript.
If you want to do raw processing then you don't really care about the thumbnails. No idea about the javascript compile process.