refactor: type readable-stream-node-to-web
This commit is contained in:
parent
a9f7919460
commit
67ee15c40e
8
src/react-app-env.d.ts
vendored
8
src/react-app-env.d.ts
vendored
@ -206,3 +206,11 @@ declare module 'idb-chunk-store' {
|
||||
TorrentOptions.store
|
||||
): ChunkStore
|
||||
}
|
||||
|
||||
declare module 'readable-stream-node-to-web' {
|
||||
export const WEBSTREAM_SUPPORT: boolean
|
||||
|
||||
export default function nodeToWeb(
|
||||
readableStream: NodeJS.ReadableStream
|
||||
): ReadableStream
|
||||
}
|
||||
|
@ -3,13 +3,11 @@ import streamSaver from 'streamsaver'
|
||||
import { Keychain, plaintextSize, encryptedSize } from 'wormhole-crypto'
|
||||
import idbChunkStore from 'idb-chunk-store'
|
||||
import { detectIncognito } from 'detectincognitojs'
|
||||
import nodeToWebStream from 'readable-stream-node-to-web'
|
||||
|
||||
import { trackerUrls } from 'config/trackerUrls'
|
||||
import { streamSaverUrl } from 'config/streamSaverUrl'
|
||||
|
||||
// @ts-ignore
|
||||
import nodeToWebStream from 'readable-stream-node-to-web'
|
||||
|
||||
streamSaver.mitm = streamSaverUrl
|
||||
|
||||
const getKeychain = (password: string) => {
|
||||
@ -59,7 +57,7 @@ export class FileTransfer {
|
||||
const keychain = getKeychain(password)
|
||||
|
||||
const decryptedStream: ReadableStream = await keychain.decryptStream(
|
||||
new nodeToWebStream(file.createReadStream())
|
||||
nodeToWebStream(file.createReadStream())
|
||||
)
|
||||
|
||||
return decryptedStream
|
||||
|
Loading…
Reference in New Issue
Block a user