Got it working in streamtest.js (last 4 lines are the interesting bit)