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

Commit

Permalink
chore: validate blob/file have a stream property
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 20, 2021
1 parent c5e02da commit ded6c36
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ipfs-core-utils/src/files/normalise-input/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ function isBytes (obj) {

/**
* @param {any} obj
* @returns {obj is Blob}
* @returns {obj is globalThis.Blob}
*/
function isBlob (obj) {
return obj.constructor && (obj.constructor.name === 'Blob' || obj.constructor.name === 'File')
return obj.constructor &&
(obj.constructor.name === 'Blob' || obj.constructor.name === 'File') &&
typeof obj.stream === 'function'
}

/**
Expand Down

0 comments on commit ded6c36

Please sign in to comment.