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

Method upload

apps/web/services/upload/index.ts:24–35  ·  view source on GitHub ↗
(file: File, type: UploadEnum = 'attachments')

Source from the content-addressed store, hash-verified

22
23export default class UploadService {
24 static async upload(file: File, type: UploadEnum = 'attachments') {
25 const folder = mapFolder[type];
26 if (!folder) {
27 throw new Error('invalid option');
28 }
29 const path = [folder, v4(), file.name || 'unknown'].join('/');
30 await uploadFile({ Key: path, Body: file.buffer });
31 return {
32 id: file.id,
33 url: [LINEN_STATIC_CDN, path].join('/'),
34 };
35 }
36}

Callers

nothing calls this directly

Calls 1

uploadFileFunction · 0.90

Tested by

no test coverage detected