-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
You could possible avoid node streams altogether here: #6
Comments
If i understood all what your code is doing then maybe you can replace all of this: pandora-protocol-reference/src/pandora-locations/browser/browser-pandora-locations.js Lines 121 to 170 in 3e5750c
...node stuff with just javascript api:s and avoid the need of having to convert/pipe a node stream to a web stream by just using web streams directly instead const {chunksCount, absolutePath, chunkSize} = pandoraBoxStream
let i = 0
const mystream = new ReadableStream({
start (ctrl) {
// return a promise if you have to wait for something
// or remove this altogether
},
pull (ctrl) {
return new Promise(resolve, reject => {
this.getLocationStreamChunk(absolutePath, i, chunkSize, pandoraBoxStream.chunkRealSize(i), (err, buffer) => {
if (err) return reject(err)
if (stopped) return reject(new Error('stopped'))
ctrl.enqueue(buffer)
if (++i === chunksCount) ctrl.close() // done writing this file now
})
})
},
cancel() {
// something cancel
// user could have cancel from browser UI
// You could remove this also...
}
})
ctrl.enqueue({
name: pandoraBoxStream.path,
lastModified: new Date(0),
stream () {
// You could also move all of the above in here too.
// (thought it created too much indentation)
return mystream
},
}); |
There is an array of pandoraBoxStreams. LE: you are right, I will integrate it now. Thanks for the support. |
Maybe i didn't grasp all of what your code is doing then...
The above code will be executed for each pandoraBoxStreams if i did it correctly (but maybe not)
So i maybe was right :) (updated the above code just slightly) |
I have updated it, but I encounter the same error described last time. I wish you a great sleep! Thanks for the help. I will search furthermore the incompatibility for the |
you probably need to have the same polyfilled web streams as conflux have all over the place for now to make it work
import { WritableStream, ReadableStream, TransformStream } from 'web-streams-polyfill/ponyfill'
import streamSaver from 'streamsaver'
// change streamsaver WritableStream to be a polyfilled version instead
streamSaver.WritableStream = WritableStream |
hi @jimmywarting ! Thank you so much for the support. Indeed it solves the above errors. I was able to make the saveAs working with your help! I will try to see if it works with 2-3-4 gb streams. |
Feel free to close the issue |
Here is two issues
pandora-protocol-reference/src/pandora-locations/browser/browser-pandora-locations.js
Lines 137 to 145 in 3e5750c
137: it's a node stream and not a web stream
144: this is not how a File like object looks like... stream should be a function that returns a new web ReadableStream:
The text was updated successfully, but these errors were encountered: