Skip to content

Commit b877a86

Browse files
Update bucketVersionsStats to work with BigInts
Issue: S3UTILS-188
1 parent d5d2b0a commit b877a86

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

bucketVersionsStats.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ const s3 = new AWS.S3(Object.assign(options, s3Options));
132132

133133
const stats = {
134134
current: {
135-
count: 0,
136-
size: 0,
135+
count: 0n,
136+
size: 0n,
137137
},
138138
noncurrent: {
139-
count: 0,
140-
size: 0,
139+
count: 0n,
140+
size: 0n,
141141
},
142142
};
143143

@@ -147,8 +147,8 @@ let VersionIdMarker;
147147
function _logProgress(message) {
148148
const loggedStats = {
149149
total: {
150-
count: stats.current.count + stats.noncurrent.count,
151-
size: stats.current.size + stats.noncurrent.size,
150+
count: BigInt(stats.current.count + stats.noncurrent.count),
151+
size: BigInt(stats.current.size + stats.noncurrent.size),
152152
},
153153
...stats,
154154
};
@@ -199,8 +199,8 @@ function listBucket(bucket, cb) {
199199
}
200200
}
201201
const statObj = version.IsLatest ? stats.current : stats.noncurrent;
202-
statObj.count += 1;
203-
statObj.size += version.Size || 0;
202+
statObj.count += 1n;
203+
statObj.size += version.Size || 0n;
204204
if (VERBOSE) {
205205
log.info('version info', {
206206
bucket: BUCKET,

0 commit comments

Comments
 (0)