@nxtedition/lib 26.8.6 → 26.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/s3.js +3 -11
package/package.json
CHANGED
package/s3.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import crypto from 'node:crypto'
|
|
2
|
-
import stream from 'node:stream'
|
|
3
2
|
import tp from 'node:timers/promises'
|
|
4
3
|
import AWS from '@aws-sdk/client-s3'
|
|
5
4
|
import PQueue from 'p-queue'
|
|
6
5
|
import { NodeHttpHandler } from '@smithy/node-http-handler'
|
|
7
6
|
import { request as undiciRequest, parseHeaders } from '@nxtedition/nxt-undici'
|
|
8
7
|
|
|
9
|
-
const QUEUE = new PQueue({ concurrency:
|
|
8
|
+
const QUEUE = new PQueue({ concurrency: 16 })
|
|
10
9
|
const MD5_HEX_EXPR = /^[A-F0-9]{32}$/i
|
|
11
10
|
|
|
12
11
|
/**
|
|
@@ -100,7 +99,7 @@ export async function upload({
|
|
|
100
99
|
queue = QUEUE,
|
|
101
100
|
signal,
|
|
102
101
|
logger,
|
|
103
|
-
partSize =
|
|
102
|
+
partSize = 5e6,
|
|
104
103
|
params,
|
|
105
104
|
}) {
|
|
106
105
|
if (s3 == null) {
|
|
@@ -197,14 +196,7 @@ export async function upload({
|
|
|
197
196
|
ContentMD5: Buffer.from(hash, 'hex').toString('base64'),
|
|
198
197
|
ContentLength: size,
|
|
199
198
|
PartNumber: number,
|
|
200
|
-
Body:
|
|
201
|
-
read() {
|
|
202
|
-
for (const chunk of chunks) {
|
|
203
|
-
this.push(chunk)
|
|
204
|
-
}
|
|
205
|
-
this.push(null)
|
|
206
|
-
},
|
|
207
|
-
}),
|
|
199
|
+
Body: Buffer.concat(chunks),
|
|
208
200
|
}),
|
|
209
201
|
)
|
|
210
202
|
logger?.debug({ number, size, etag: ETag }, 'part upload completed')
|