MCPcopy Index your code
hub / github.com/simstudioai/sim / exportWorkflowsToZip

Function exportWorkflowsToZip

apps/sim/lib/workflows/operations/import-export.ts:184–204  ·  view source on GitHub ↗
(workflows: WorkflowExportData[])

Source from the content-addressed store, hash-verified

182 * Workflows are placed at the root level (no folder structure).
183 */
184export async function exportWorkflowsToZip(workflows: WorkflowExportData[]): Promise<Blob> {
185 const JSZip = await getJSZip()
186 const zip = new JSZip()
187 const seenFilenames = new Set<string>()
188
189 for (const workflow of workflows) {
190 const jsonContent = exportWorkflowToJson(workflow)
191 const baseName = sanitizePathSegment(workflow.workflow.name)
192 let filename = `${baseName}.json`
193 let counter = 1
194
195 while (seenFilenames.has(filename.toLowerCase())) {
196 filename = `${baseName}-${counter}.json`
197 counter++
198 }
199 seenFilenames.add(filename.toLowerCase())
200 zip.file(filename, jsonContent)
201 }
202
203 return await zip.generateAsync({ type: 'blob' })
204}
205
206function buildFolderPath(
207 folderId: string | null | undefined,

Callers 2

useExportWorkflowFunction · 0.90
useExportSelectionFunction · 0.90

Calls 4

getJSZipFunction · 0.85
exportWorkflowToJsonFunction · 0.85
sanitizePathSegmentFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected