Refactor out BufferStream

Moved BufferStream to its own common file.
```js
module.exports = BufferStream;
```