forked from Cap-go/capgo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-s3-size.ts
More file actions
34 lines (27 loc) · 829 Bytes
/
test-s3-size.ts
File metadata and controls
34 lines (27 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { S3Client } from '@bradenmacdonald/s3-lite-client'
async function testS3Size() {
const filePath = 'orgs/***/apps/ee.forgr.capacitor_go/12.8.5.zip'
try {
const client = new S3Client({
endPoint: 'https://***.r2.cloudflarestorage.com',
accessKey: '***',
pathStyle: true,
secretKey: '***',
region: 'auto',
bucket: 'capgo',
})
console.log('Testing S3 size for path:', filePath)
const file = await client.statObject(filePath)
const size = file.size ?? 0
console.log('File size:', size, 'bytes')
console.log('File size:', (size / 1024 / 1024).toFixed(2), 'MB')
if (size === 0) {
console.log('File might not exist or has 0 size')
}
}
catch (error) {
console.error('Error testing S3 size:', error)
}
}
// Run the test
testS3Size()