MCPcopy Index your code
hub / github.com/FlowiseAI/Flowise / getFileName

Function getFileName

packages/server/src/utils/index.ts:356–380  ·  view source on GitHub ↗
(fileBase64: string)

Source from the content-addressed store, hash-verified

354 * @param {string} fileBase64
355 */
356export const getFileName = (fileBase64: string): string => {
357 let fileNames = []
358 if (fileBase64.startsWith('FILE-STORAGE::')) {
359 const names = fileBase64.substring(14)
360 if (names.includes('[') && names.includes(']')) {
361 const files = JSON.parse(names)
362 return files.join(', ')
363 } else {
364 return fileBase64.substring(14)
365 }
366 }
367 if (fileBase64.startsWith('[') && fileBase64.endsWith(']')) {
368 const files = JSON.parse(fileBase64)
369 for (const file of files) {
370 const splitDataURI = file.split(',')
371 const filename = splitDataURI[splitDataURI.length - 1].split(':')[1]
372 fileNames.push(filename)
373 }
374 return fileNames.join(', ')
375 } else {
376 const splitDataURI = fileBase64.split(',')
377 const filename = splitDataURI[splitDataURI.length - 1].split(':')[1]
378 return filename
379 }
380}
381
382/**
383 * Save upsert flowData

Callers 1

saveUpsertFlowDataFunction · 0.70

Calls 1

parseMethod · 0.65

Tested by

no test coverage detected