Refactor out BufferStream

Moved BufferStream to its own common file.
```js
require('../common/bufferstream.js');
```