mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-25 07:06:25 -08:00
attempt
This commit is contained in:
parent
aaa1d64f1f
commit
0b72a64b84
|
@ -346,9 +346,13 @@ export default class Files {
|
||||||
}
|
}
|
||||||
|
|
||||||
let ord:number[] = []
|
let ord:number[] = []
|
||||||
|
// hopefully this regulates it?
|
||||||
|
let lastChunkSent = true
|
||||||
|
|
||||||
let dataStream = new Readable({
|
let dataStream = new Readable({
|
||||||
read(){
|
read(){
|
||||||
|
if (!lastChunkSent) return
|
||||||
|
lastChunkSent = false
|
||||||
console.log(`${uploadId}: Getting chunk ${position+1}/${attachments.length}`)
|
console.log(`${uploadId}: Getting chunk ${position+1}/${attachments.length}`)
|
||||||
let gC = position+1
|
let gC = position+1
|
||||||
getNextChunk().then(async (nextChunk) => {
|
getNextChunk().then(async (nextChunk) => {
|
||||||
|
@ -357,11 +361,17 @@ export default class Files {
|
||||||
if (nextChunk == "__ERR") {this.destroy(new Error("file read error")); return}
|
if (nextChunk == "__ERR") {this.destroy(new Error("file read error")); return}
|
||||||
let response = this.push(nextChunk)
|
let response = this.push(nextChunk)
|
||||||
|
|
||||||
|
if (!nextChunk) return // EOF
|
||||||
|
|
||||||
while (response) {
|
while (response) {
|
||||||
|
console.log(`${uploadId}: Getting chunk ${position+1}/${attachments.length}`)
|
||||||
let nextChunk = await getNextChunk()
|
let nextChunk = await getNextChunk()
|
||||||
|
let gC = position+1
|
||||||
|
ord.push(gC)
|
||||||
response = this.push(nextChunk)
|
response = this.push(nextChunk)
|
||||||
if (!nextChunk) return
|
if (!nextChunk) return
|
||||||
}
|
}
|
||||||
|
lastChunkSent = true
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue