MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getMimeType

Function getMimeType

frontend/preview/mock/mockfilesystem.ts:115–159  ·  view source on GitHub ↗
(path: string, isdir: boolean)

Source from the content-addressed store, hash-verified

113}
114
115function getMimeType(path: string, isdir: boolean): string {
116 if (isdir) {
117 return MockDirMimeType;
118 }
119 if (path.endsWith(".md")) {
120 return "text/markdown";
121 }
122 if (path.endsWith(".json")) {
123 return "application/json";
124 }
125 if (path.endsWith(".ts")) {
126 return "text/typescript";
127 }
128 if (path.endsWith(".tsx")) {
129 return "text/tsx";
130 }
131 if (path.endsWith(".js")) {
132 return "text/javascript";
133 }
134 if (path.endsWith(".txt") || path.endsWith(".log") || path.endsWith(".bashrc") || path.endsWith(".zprofile")) {
135 return "text/plain";
136 }
137 if (path.endsWith(".png")) {
138 return "image/png";
139 }
140 if (path.endsWith(".jpg") || path.endsWith(".jpeg")) {
141 return "image/jpeg";
142 }
143 if (path.endsWith(".pdf")) {
144 return "application/pdf";
145 }
146 if (path.endsWith(".zip")) {
147 return "application/zip";
148 }
149 if (path.endsWith(".dmg")) {
150 return "application/x-apple-diskimage";
151 }
152 if (path.endsWith(".svg")) {
153 return "image/svg+xml";
154 }
155 if (path.endsWith(".yaml") || path.endsWith(".yml")) {
156 return "application/yaml";
157 }
158 return "application/octet-stream";
159}
160
161function makeContentBytes(content: string | Uint8Array): Uint8Array {
162 if (content instanceof Uint8Array) {

Callers 1

buildEntriesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected