josephg / josephg/braid-protocol
Use node-web-streams
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
The client can be used in the browser or in a nodejs process. We use [two separate mechanisms](https://github.com/josephg/braid-protocol/blob/5500d28cae6cbd7fecc6e65573cd77995efadea5/client/client.ts#L190-L219) to read the stream in each case. A potentially more elegant solution was [identified here](https://github.com/braid-org/braidjs/commit/af033cfba71cc64497be6b6424993cd2604be302#diff-4827730faee7df58c4a8790ebcfece19b2678b57c9d56bcbe50a87d566bb2ba2R4-R10):
```
// On nodejs, this requires "npm install node-fetch node-web-streams"
if (typeof window === 'undefined') {
var fetch = require('node-fetch')
var Headers = fetch.Headers
var to_whatwg_stream = require('node-web-streams').toWebReadableStream
module.exports = braid_fetch
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.