MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / uploadFile

Function uploadFile

apps/web/services/aws/s3.ts:31–48  ·  view source on GitHub ↗
({
  Key,
  Body,
  CacheControl = 'max-age=15557000, stale-if-error=31536000',
}: UploadFileInput)

Source from the content-addressed store, hash-verified

29>;
30
31export async function uploadFile({
32 Key,
33 Body,
34 CacheControl = 'max-age=15557000, stale-if-error=31536000',
35}: UploadFileInput) {
36 try {
37 const command = new PutObjectCommand({
38 Bucket,
39 Key,
40 Body,
41 ContentType: getMimeType(path.extname(Key!)),
42 CacheControl,
43 });
44 return await s3Client.send(command);
45 } catch (error) {
46 console.error(error);
47 }
48}
49
50export async function deleteFiles(
51 Objects: {

Callers 5

processUploadFunction · 0.90
uploadFunction · 0.90
uploadMethod · 0.90
processLinkFunction · 0.90
uploadDirFunction · 0.85

Calls 3

getMimeTypeFunction · 0.85
errorMethod · 0.65
sendMethod · 0.45

Tested by

no test coverage detected