@remotion/lambda 4.0.72 → 4.0.74

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.
@@ -9,6 +9,7 @@ const mime_types_1 = __importDefault(require("mime-types"));
9
9
  const node_fs_1 = require("node:fs");
10
10
  const node_path_1 = __importDefault(require("node:path"));
11
11
  const aws_clients_1 = require("../shared/aws-clients");
12
+ const chunk_1 = require("../shared/chunk");
12
13
  const make_s3_key_1 = require("../shared/make-s3-key");
13
14
  const getDirFiles = (entry) => {
14
15
  throw new TypeError('should only be executed in test ' + JSON.stringify(entry));
@@ -51,34 +52,39 @@ const uploadDir = async ({ bucket, region, localDir, onProgress, keyPrefix, priv
51
52
  progresses[file.name] = 0;
52
53
  }
53
54
  const client = (0, aws_clients_1.getS3Client)(region, null);
54
- const uploads = files.map((filePath) => {
55
- const Key = (0, make_s3_key_1.makeS3Key)(keyPrefix, localDir, filePath.name);
56
- const Body = (0, node_fs_1.createReadStream)(filePath.name);
57
- const ContentType = mime_types_1.default.lookup(Key) || 'application/octet-stream';
58
- const ACL = privacy === 'no-acl'
59
- ? undefined
60
- : privacy === 'private'
61
- ? 'private'
62
- : 'public-read';
63
- const paralellUploads3 = new lib_storage_1.Upload({
64
- client,
65
- queueSize: 4,
66
- partSize: 5 * 1024 * 1024,
67
- params: {
68
- Key,
69
- Bucket: bucket,
70
- Body,
71
- ACL,
72
- ContentType,
73
- },
74
- });
75
- paralellUploads3.on('httpUploadProgress', (progress) => {
76
- var _a;
77
- progresses[filePath.name] = (_a = progress.loaded) !== null && _a !== void 0 ? _a : 0;
78
- });
79
- return paralellUploads3.done();
80
- });
81
- const promise = Promise.all(uploads);
55
+ const chunkedFiles = (0, chunk_1.chunk)(files, 200);
56
+ const uploadAll = (async () => {
57
+ for (const filesChunk of chunkedFiles) {
58
+ const uploads = filesChunk.map((filePath) => {
59
+ const Key = (0, make_s3_key_1.makeS3Key)(keyPrefix, localDir, filePath.name);
60
+ const Body = (0, node_fs_1.createReadStream)(filePath.name);
61
+ const ContentType = mime_types_1.default.lookup(Key) || 'application/octet-stream';
62
+ const ACL = privacy === 'no-acl'
63
+ ? undefined
64
+ : privacy === 'private'
65
+ ? 'private'
66
+ : 'public-read';
67
+ const paralellUploads3 = new lib_storage_1.Upload({
68
+ client,
69
+ queueSize: 4,
70
+ partSize: 5 * 1024 * 1024,
71
+ params: {
72
+ Key,
73
+ Bucket: bucket,
74
+ Body,
75
+ ACL,
76
+ ContentType,
77
+ },
78
+ });
79
+ paralellUploads3.on('httpUploadProgress', (progress) => {
80
+ var _a;
81
+ progresses[filePath.name] = (_a = progress.loaded) !== null && _a !== void 0 ? _a : 0;
82
+ });
83
+ return paralellUploads3.done();
84
+ });
85
+ await Promise.all(uploads);
86
+ }
87
+ })();
82
88
  const interval = setInterval(() => {
83
89
  onProgress({
84
90
  totalSize: files.map((f) => f.size).reduce((a, b) => a + b, 0),
@@ -87,7 +93,7 @@ const uploadDir = async ({ bucket, region, localDir, onProgress, keyPrefix, priv
87
93
  filesUploaded: files.filter((f) => progresses[f.name] === f.size).length,
88
94
  });
89
95
  }, 1000);
90
- await promise;
96
+ await uploadAll;
91
97
  clearInterval(interval);
92
98
  };
93
99
  exports.uploadDir = uploadDir;
@@ -0,0 +1 @@
1
+ export declare const chunk: <T>(input: T[], size: number) => T[][];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.chunk = void 0;
4
+ const chunk = (input, size) => {
5
+ return input.reduce((arr, item, idx) => {
6
+ return idx % size === 0
7
+ ? [...arr, [item]]
8
+ : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];
9
+ }, []);
10
+ };
11
+ exports.chunk = chunk;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/lambda",
3
- "version": "4.0.72",
3
+ "version": "4.0.74",
4
4
  "description": "Distributed renderer for Remotion based on AWS Lambda",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -26,10 +26,10 @@
26
26
  "aws-policies": "^1.0.1",
27
27
  "mime-types": "2.1.34",
28
28
  "zod": "3.22.3",
29
- "@remotion/bundler": "4.0.72",
30
- "@remotion/renderer": "4.0.72",
31
- "@remotion/cli": "4.0.72",
32
- "remotion": "4.0.72"
29
+ "@remotion/bundler": "4.0.74",
30
+ "remotion": "4.0.74",
31
+ "@remotion/cli": "4.0.74",
32
+ "@remotion/renderer": "4.0.74"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jonny/eslint-config": "3.0.276",
@@ -43,11 +43,11 @@
43
43
  "ts-node": "^10.8.0",
44
44
  "vitest": "0.31.1",
45
45
  "zip-lib": "^0.7.2",
46
- "@remotion/bundler": "4.0.72",
47
- "@remotion/compositor-linux-arm64-gnu": "4.0.72"
46
+ "@remotion/compositor-linux-arm64-gnu": "4.0.74",
47
+ "@remotion/bundler": "4.0.74"
48
48
  },
49
49
  "peerDependencies": {
50
- "@remotion/bundler": "4.0.72"
50
+ "@remotion/bundler": "4.0.74"
51
51
  },
52
52
  "publishConfig": {
53
53
  "access": "public"
Binary file