changed streaming code to use new readAtLeast function, updated dependencies
This commit is contained in:
parent
30a7c29192
commit
21297658fe
|
@ -11,7 +11,7 @@ crate-type = ["cdylib", "rlib"]
|
|||
block-modes = "0.8"
|
||||
blowfish = "0.8"
|
||||
aes = "0.7"
|
||||
md-5 = "0.9"
|
||||
md-5 = "0.10"
|
||||
hex = "0.4"
|
||||
|
||||
wasm-bindgen = "0.2"
|
||||
|
|
File diff suppressed because one or more lines are too long
15
index.js
15
index.js
|
@ -321,21 +321,14 @@ async function pipeDecryptedStream(writer, body, length, cipher) {
|
|||
let end = false
|
||||
while (!end) {
|
||||
end = byteCount + 2048 > length
|
||||
let chunk
|
||||
let minBytes
|
||||
if (!end) {
|
||||
chunk = new Int8Array(2048)
|
||||
minBytes = 2048
|
||||
} else {
|
||||
chunk = new Int8Array(length - byteCount)
|
||||
minBytes = length - byteCount
|
||||
}
|
||||
|
||||
// if read chunk isn't 2048 bytes, read until it is
|
||||
// cause of retarded readable streams not having an option to specify min bytes
|
||||
let tempLength = 0
|
||||
while (tempLength !== chunk.length) {
|
||||
let read = (await reader.read(new Int8Array(chunk.length - tempLength))).value
|
||||
chunk.set(read, tempLength)
|
||||
tempLength += read.length
|
||||
}
|
||||
let chunk = (await reader.readAtLeast(minBytes, new Uint8Array(2048))).value
|
||||
|
||||
if (byteCount % 6144 === 0 && !end) {
|
||||
// encrypted chunk
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"browser-id3-writer": "^4.4.0",
|
||||
"itty-router": "^2.4.4",
|
||||
"itty-router": "^2.4.8",
|
||||
"serverless-cloudflare-workers": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -2401,9 +2401,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/itty-router": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.4.4.tgz",
|
||||
"integrity": "sha512-mp5i47ZotK94FHondKJTZn/0dBAFzFpZpiHWn+aCgr/sg9cIVzt1gvLCKsXMkcHgKejb9GdhqvOfh7VYJJlQoQ=="
|
||||
"version": "2.4.8",
|
||||
"resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.4.8.tgz",
|
||||
"integrity": "sha512-VpAHeAN+/ABLqT/zEnwMomNCDh8eRrs06C8HRR8OxjVwGhXtvzoJbggjUnjAeNGxqjV4w7pp87Iu8jzEpr92fg=="
|
||||
},
|
||||
"node_modules/jest-worker": {
|
||||
"version": "27.0.6",
|
||||
|
@ -6813,9 +6813,9 @@
|
|||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8="
|
||||
},
|
||||
"itty-router": {
|
||||
"version": "2.4.4",
|
||||
"resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.4.4.tgz",
|
||||
"integrity": "sha512-mp5i47ZotK94FHondKJTZn/0dBAFzFpZpiHWn+aCgr/sg9cIVzt1gvLCKsXMkcHgKejb9GdhqvOfh7VYJJlQoQ=="
|
||||
"version": "2.4.8",
|
||||
"resolved": "https://registry.npmjs.org/itty-router/-/itty-router-2.4.8.tgz",
|
||||
"integrity": "sha512-VpAHeAN+/ABLqT/zEnwMomNCDh8eRrs06C8HRR8OxjVwGhXtvzoJbggjUnjAeNGxqjV4w7pp87Iu8jzEpr92fg=="
|
||||
},
|
||||
"jest-worker": {
|
||||
"version": "27.0.6",
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"browser-id3-writer": "^4.4.0",
|
||||
"itty-router": "^2.4.4",
|
||||
"itty-router": "^2.4.8",
|
||||
"serverless-cloudflare-workers": "^1.2.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ workers_dev = true
|
|||
kv_namespaces = [
|
||||
{ binding = "KV", id = "974c0967a84e415daa054bbbcc7f80c6", preview_id = "cfcc6491f3484cbca664913836635113" }
|
||||
]
|
||||
compatibility_date = "2022-01-04"
|
||||
compatibility_date = "2022-01-07"
|
||||
|
||||
# [secrets]
|
||||
# ARL
|
Loading…
Reference in New Issue