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

Commit

Permalink
chore: use web-std blob for typeof
Browse files Browse the repository at this point in the history
  • Loading branch information
vasco-santos committed Jul 20, 2021
1 parent ded6c36 commit feb1a2f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions packages/ipfs-core-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"uint8arrays": "^2.1.6"
},
"devDependencies": {
"@web-std/blob": "^2.1.1",
"@web-std/file": "^1.1.0",
"aegir": "^34.0.2",
"rimraf": "^3.0.2"
Expand Down
10 changes: 3 additions & 7 deletions packages/ipfs-core-utils/test/files/normalise-input.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ const { expect } = require('aegir/utils/chai')
const blobToIt = require('blob-to-it')
const uint8ArrayFromString = require('uint8arrays/from-string')
const all = require('it-all')
const { Blob } = require('@web-std/blob')
const { File } = require('@web-std/file')
const { Blob, ReadableStream } = globalThis
const { ReadableStream } = globalThis
const { isBrowser, isWebWorker, isElectronRenderer } = require('ipfs-utils/src/env')

let normalise = require('../../src/files/normalise-input')
Expand Down Expand Up @@ -36,12 +37,7 @@ async function verifyNormalisation (input) {
let content = input[0].content

if (isBrowser || isWebWorker || isElectronRenderer) {
try {
expect(content).to.be.an.instanceOf(Blob)
} catch (err) {
// Fallback to instance of File
expect(content).to.be.an.instanceOf(File)
}
expect(content).to.be.an.instanceOf(Blob)
content = blobToIt(content)
}

Expand Down

0 comments on commit feb1a2f

Please sign in to comment.