moving streamobject out in to an external npm module