File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 */
44
55import { db } from '@/db/schema' ;
6- import JSZip from 'jszip' ;
6+ import JSZip , { type JSZipGeneratorOptions } from 'jszip' ;
77import { saveAs } from 'file-saver' ;
88import { storage , STORAGE_KEYS } from '@/utils/storage' ;
99import { importService } from './importService' ;
1010import type { ImportOptions , ImportProgressCallback } from '@/types/import' ;
1111
12+ export const zipGenOptions : JSZipGeneratorOptions < 'blob' > = { type : 'blob' , compression : 'DEFLATE' , compressionOptions : { level : 5 } } ;
13+
1214export class ExportService {
1315 /**
1416 * 导出单个项目为 JSON
@@ -126,7 +128,7 @@ export class ExportService {
126128 )
127129 ) ;
128130
129- const blob = await zip . generateAsync ( { type : 'blob' } ) ;
131+ const blob = await zip . generateAsync ( zipGenOptions ) ;
130132 saveAs ( blob , `prompt-studio-backup-${ Date . now ( ) } .zip` ) ;
131133 }
132134
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { importService } from './importService';
1010import { ImportOptions , ImportProgressCallback } from '@/types/import' ;
1111import { useI18nStore } from '@/store/i18nStore' ;
1212import { translations } from '@/i18n/locales' ;
13+ import { zipGenOptions } from './exportService' ;
1314
1415export interface WebDAVConfig {
1516 url : string ;
@@ -145,7 +146,7 @@ export class WebDAVService {
145146 ) ;
146147
147148 // 2. 生成 ZIP
148- const blob = await zip . generateAsync ( { type : 'blob' } ) ;
149+ const blob = await zip . generateAsync ( zipGenOptions ) ;
149150
150151 // 3. 上传到 WebDAV
151152 const filename = `prompt-studio-backup-${ Date . now ( ) } .zip` ;
You can’t perform that action at this time.
0 commit comments