Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Use alternative Blob check #71
Browse files Browse the repository at this point in the history
  • Loading branch information
117 committed Aug 17, 2021
1 parent 89ab447 commit 7e98b3d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file. See [standa

### [6.2.6](https://github.com/117/alpaca/compare/v6.2.5...v6.2.6) (2021-08-17)

- Use alternative `Blob` check. [#71](https://github.com/117/alpaca/issues/71).

### [6.2.5](https://github.com/117/alpaca/compare/v6.2.1...v6.2.5) (2021-07-26)

- Change return types to `boolean` as requested [#76](https://github.com/117/alpaca/issues/76).
Expand Down
4 changes: 2 additions & 2 deletions src/stream.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import WebSocket from 'isomorphic-ws'
import EventEmitter from 'eventemitter3'

import isBlob from 'is-blob'
import urls from './urls.js'

import {
Expand Down Expand Up @@ -107,7 +107,7 @@ export class AlpacaStream extends EventEmitter<string | symbol | any> {
this.connection.onmessage = async (event: any) => {
let data = event.data

if (data instanceof Blob) {
if (isBlob(data)) {
data = await event.data.text()
} else if (data instanceof ArrayBuffer) {
data = String.fromCharCode(...new Uint8Array(event.data))
Expand Down

0 comments on commit 7e98b3d

Please sign in to comment.