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

Function ensureUploadsDirectory

apps/sim/lib/uploads/core/setup.server.ts:25–47  ·  view source on GitHub ↗

* Server-only function to ensure uploads directory exists

()

Source from the content-addressed store, hash-verified

23 * Server-only function to ensure uploads directory exists
24 */
25async function ensureUploadsDirectory() {
26 if (USE_S3_STORAGE) {
27 logger.info('Using S3 storage, skipping local uploads directory creation')
28 return true
29 }
30
31 if (USE_BLOB_STORAGE) {
32 logger.info('Using Azure Blob storage, skipping local uploads directory creation')
33 return true
34 }
35
36 try {
37 if (!existsSync(UPLOAD_DIR_SERVER)) {
38 await mkdir(UPLOAD_DIR_SERVER, { recursive: true })
39 } else {
40 logger.info(`Uploads directory already exists at ${UPLOAD_DIR_SERVER}`)
41 }
42 return true
43 } catch (error) {
44 logger.error('Failed to create uploads directory:', error)
45 return false
46 }
47}
48
49// Immediately invoke on server startup
50if (typeof process !== 'undefined') {

Callers 1

setup.server.tsFile · 0.85

Calls 2

infoMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected