MCPcopy Index your code
hub / github.com/Linen-dev/linen.dev / processAttachments

Function processAttachments

packages/queue/src/tasks/remove-community.ts:129–155  ·  view source on GitHub ↗
({
  attachments,
  logger,
}: {
  attachments: messageAttachments[];
  logger: Logger;
})

Source from the content-addressed store, hash-verified

127}
128
129async function processAttachments({
130 attachments,
131 logger,
132}: {
133 attachments: messageAttachments[];
134 logger: Logger;
135}) {
136 const keys = attachments
137 .filter((e) => !!e.internalUrl)
138 .map((attachment) => ({
139 Key: attachment
140 .internalUrl!.split('/')
141 .slice(3)
142 .join('/')
143 .replace(/\u0010/, ''),
144 }));
145
146 while (keys.length) {
147 const slice = keys.splice(0, 1000);
148 try {
149 await deleteFiles(slice);
150 } catch (error) {
151 logger.error({ slice });
152 throw error;
153 }
154 }
155}

Callers 1

cleanUpFunction · 0.70

Calls 3

deleteFilesFunction · 0.90
mapMethod · 0.80
errorMethod · 0.65

Tested by

no test coverage detected