| 63 | } |
| 64 | |
| 65 | const getMimeType = (ext: string) => { |
| 66 | const mimes: Record<string, string> = { |
| 67 | '.aac': 'audio/aac', |
| 68 | '.avi': 'video/x-msvideo', |
| 69 | '.css': 'text/css', |
| 70 | '.csv': 'text/csv', |
| 71 | '.doc': 'application/msword', |
| 72 | '.gif': 'image/gif', |
| 73 | '.htm': 'text/html', |
| 74 | '.html': 'text/html', |
| 75 | '.ico': 'image/x-icon', |
| 76 | '.jpeg': 'image/jpeg', |
| 77 | '.jpg': 'image/jpeg', |
| 78 | '.js': 'application/javascript', |
| 79 | '.json': 'application/json', |
| 80 | '.mpeg': 'video/mpeg', |
| 81 | '.mov': 'video/quicktime', |
| 82 | '.pdf': 'application/pdf', |
| 83 | '.ppt': 'application/vnd.ms-powerpoint', |
| 84 | '.png': 'image/png', |
| 85 | '.rar': 'application/x-rar-compressed', |
| 86 | '.rtf': 'application/rtf', |
| 87 | '.svg': 'image/svg+xml', |
| 88 | '.tar': 'application/x-tar', |
| 89 | '.tif': 'image/tiff', |
| 90 | '.tiff': 'image/tiff', |
| 91 | '.txt': 'text/plain', |
| 92 | '.wav': 'audio/x-wav', |
| 93 | '.weba': 'audio/webm', |
| 94 | '.webm': 'video/webm', |
| 95 | '.webp': 'image/webp', |
| 96 | '.xhtml': 'application/xhtml+xml', |
| 97 | '.xls': 'application/vnd.ms-excel', |
| 98 | '.xml': 'application/xml', |
| 99 | '.zip': 'application/zip', |
| 100 | '.7z': 'application/x-7z-compressed', |
| 101 | }; |
| 102 | return mimes[ext] || 'application/octet-stream'; |
| 103 | }; |
| 104 | |
| 105 | export const createPresignedUrl = ({ key }: { key: string }) => { |
| 106 | const command = new PutObjectCommand({ Bucket, Key: key }); |