@nxtedition/lib 19.0.42 → 19.0.43

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/s3.js +3 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "19.0.42",
3
+ "version": "19.0.43",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
package/s3.js CHANGED
@@ -1,20 +1,14 @@
1
1
  import crypto from 'node:crypto'
2
2
  import stream from 'node:stream'
3
- import assert from 'node:assert'
4
3
  import AWS from '@aws-sdk/client-s3'
5
4
  import PQueue from 'p-queue'
6
5
 
7
6
  const CONTENT_MD5_EXPR = /^[A-F0-9]{32}$/i
8
7
  const CONTENT_LENGTH_EXPR = /^\d+$/i
9
8
 
10
- export async function upload({
11
- client: s3,
12
- signal,
13
- logger,
14
- partSize = 16e6,
15
- queueSize = 2,
16
- params,
17
- }) {
9
+ const queue = new PQueue({ concurrency: 16 })
10
+
11
+ export async function upload({ client: s3, signal, logger, partSize = 16e6, params }) {
18
12
  if (s3 == null) {
19
13
  throw new Error('Invalid client')
20
14
  }
@@ -23,10 +17,6 @@ export async function upload({
23
17
  throw new Error('Invalid partSize')
24
18
  }
25
19
 
26
- if (!Number.isFinite(queueSize) || queueSize <= 0 || queueSize > 32) {
27
- throw new Error('Invalid queueSize')
28
- }
29
-
30
20
  if (params == null || typeof params !== 'object') {
31
21
  throw new Error('Invalid params')
32
22
  }
@@ -41,11 +31,8 @@ export async function upload({
41
31
  throw new Error(`Invalid ContentLength: ${ContentLength}`)
42
32
  }
43
33
 
44
- const queue = new PQueue({ concurrency: queueSize })
45
34
  const promises = []
46
35
 
47
- assert(queue.concurrency > 0 && queue.concurrency <= 32)
48
-
49
36
  const ac = new AbortController()
50
37
  const onAbort = () => {
51
38
  ac.abort()