tt-help-cli-ycl 1.3.10 → 1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/watch/server.mjs +6 -2
package/package.json
CHANGED
package/src/watch/server.mjs
CHANGED
|
@@ -307,9 +307,13 @@ export function startWatchServer(outputFile, port = 3000, existingStore) {
|
|
|
307
307
|
const scriptFile = join(batDir, scriptMatch[1]);
|
|
308
308
|
if (existsSync(scriptFile)) {
|
|
309
309
|
const content = readFileSync(scriptFile);
|
|
310
|
-
const
|
|
310
|
+
const fileName = scriptMatch[1];
|
|
311
|
+
const ext = fileName.split('.').pop();
|
|
311
312
|
const mime = ext === 'sh' ? 'text/x-sh' : ext === 'bat' ? 'text/bat' : 'text/plain';
|
|
312
|
-
res.writeHead(200, {
|
|
313
|
+
res.writeHead(200, {
|
|
314
|
+
'Content-Type': `${mime}; charset=utf-8`,
|
|
315
|
+
'Content-Disposition': `attachment; filename="${fileName}"`,
|
|
316
|
+
});
|
|
313
317
|
res.end(content);
|
|
314
318
|
return;
|
|
315
319
|
}
|