Skip to content

Commit

Permalink
enhancement: allow user to specify project name for ZIP file
Browse files Browse the repository at this point in the history
  • Loading branch information
mtmfahathdev committed Nov 10, 2024
1 parent ce6b65e commit 9359162
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/lib/stores/workbench.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ export class WorkbenchStore {
async downloadZip() {
const zip = new JSZip();
const files = this.files.get();
const projectName = prompt('Enter the project name:', 'project') || 'project';

for (const [filePath, dirent] of Object.entries(files)) {
if (dirent?.type === 'file' && !dirent.isBinary) {
Expand All @@ -303,7 +304,7 @@ export class WorkbenchStore {
}

const content = await zip.generateAsync({ type: 'blob' });
saveAs(content, 'project.zip');
saveAs(content, `${projectName}.zip`);
}

async syncFiles(targetHandle: FileSystemDirectoryHandle) {
Expand Down

0 comments on commit 9359162

Please sign in to comment.