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

Function resolveHttpFileUrl

apps/sim/blocks/blocks/file.ts:47–65  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

45}
46
47const resolveHttpFileUrl = (value: unknown): string => {
48 const fileUrl = typeof value === 'string' ? value.trim() : ''
49 if (!fileUrl) {
50 throw new Error('File URL is required')
51 }
52
53 let parsed: URL
54 try {
55 parsed = new URL(fileUrl)
56 } catch {
57 throw new Error('File URL must be a valid http or https URL')
58 }
59
60 if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {
61 throw new Error('File URL must use http or https')
62 }
63
64 return fileUrl
65}
66
67export const FileBlock: BlockConfig<FileParserOutput> = {
68 type: 'file',

Callers 1

file.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected