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

Function uploadDir

packages/sitemap/src/s3-sync.ts:15–32  ·  view source on GitHub ↗
(
  uploadFile: (args: {
    Key: string;
    Body: any;
    CacheControl?: string;
  }) => Promise<any>,
  s3Path: string
)

Source from the content-addressed store, hash-verified

13}
14
15export async function uploadDir(
16 uploadFile: (args: {
17 Key: string;
18 Body: any;
19 CacheControl?: string;
20 }) => Promise<any>,
21 s3Path: string
22) {
23 const files = (await getFiles(s3Path)) as string[];
24 const uploads = files.map(async (filePath) =>
25 uploadFile({
26 Key: path.relative(s3Path, filePath),
27 Body: createReadStream(filePath),
28 CacheControl: 'max-age=86400',
29 })
30 );
31 return Promise.all(uploads);
32}

Callers 1

buildFunction · 0.90

Calls 3

getFilesFunction · 0.85
uploadFileFunction · 0.85
mapMethod · 0.80

Tested by

no test coverage detected