Reimplement filesummary in JS

Fix #993