{"modulePath":"github.com/bitechdev/ResolveSpec","version":"v1.3.14","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package providers\n\n## Types\n\n```go\ntype EmbedFSProvider struct {\n\t// contains filtered or unexported fields\n}\n```\nEmbedFSProvider serves files from an embedded filesystem. It supports both direct embedded directories and embedded zip files.\n\n```go\nfunc NewEmbedFSProvider(embedFS fs.FS, zipFile string) (*EmbedFSProvider, error)\n```\nNewEmbedFSProvider creates a new EmbedFSProvider. If zipFile is empty, the embedded FS is used directly. If zipFile is specified, it's treated as a path to a zip file within the embedded FS. Use WithStripPrefix to configure path prefix stripping.\n\n```go\nfunc (p *EmbedFSProvider) Close() error\n```\nClose releases any resources held by the provider. For embedded filesystems, this is mostly a no-op since Go manages the lifecycle.\n\n```go\nfunc (p *EmbedFSProvider) Open(name string) (fs.File, error)\n```\nOpen opens the named file from the embedded filesystem. If a strip prefix is configured, it prepends the prefix to the requested path. For example, with stripPrefix=\"/dist\", requesting \"/assets/style.css\" will open \"/dist/assets/style.css\" from the embedded filesystem.\n\n```go\nfunc (p *EmbedFSProvider) StripPrefix() string\n```\nStripPrefix returns the configured strip prefix.\n\n```go\nfunc (p *EmbedFSProvider) Type() string\n```\nType returns \"embed\" or \"embed-zip\" depending on the configuration.\n\n```go\nfunc (p *EmbedFSProvider) WithStripPrefix(prefix string)\n```\nWithStripPrefix sets the prefix to strip from requested paths. For example, WithStripPrefix(\"/dist\") will make files at \"/dist/assets\" accessible via \"/assets\".\n\n```go\nfunc (p *EmbedFSProvider) ZipFile() string\n```\nZipFile returns the path to the zip file within the embedded FS, if any.\n\n```go\ntype LocalFSProvider struct {\n\t// contains filtered or unexported fields\n}\n```\nLocalFSProvider serves files from a local directory.\n\n```go\nfunc NewLocalFSProvider(path string) (*LocalFSProvider, error)\n```\nNewLocalFSProvider creates a new LocalFSProvider for the given directory path. The path must be an absolute path to an existing directory.\n\n```go\nfunc (p *LocalFSProvider) Close() error\n```\nClose releases any resources held by the provider. For local filesystem, this is a no-op since os.DirFS doesn't hold resources.\n\n```go\nfunc (p *LocalFSProvider) Open(name string) (fs.File, error)\n```\nOpen opens the named file from the local directory. If a strip prefix is configured, it prepends the prefix to the requested path. For example, with stripPrefix=\"/dist\", requesting \"/assets/style.css\" will open \"/dist/assets/style.css\" from the local filesystem.\n\n```go\nfunc (p *LocalFSProvider) Path() string\n```\nPath returns the absolute path to the directory being served.\n\n```go\nfunc (p *LocalFSProvider) Reload() error\n```\nReload refreshes the filesystem view. For local directories, os.DirFS automatically picks up changes, so this recreates the DirFS to ensure a fresh view.\n\n```go\nfunc (p *LocalFSProvider) StripPrefix() string\n```\nStripPrefix returns the configured strip prefix.\n\n```go\nfunc (p *LocalFSProvider) Type() string\n```\nType returns \"local\".\n\n```go\nfunc (p *LocalFSProvider) WithStripPrefix(prefix string)\n```\nWithStripPrefix sets the prefix to strip from requested paths. For example, WithStripPrefix(\"/dist\") will make files at \"/dist/assets\" accessible via \"/assets\".\n\n```go\ntype ZipFSProvider struct {\n\t// contains filtered or unexported fields\n}\n```\nZipFSProvider serves files from a zip file.\n\n```go\nfunc NewZipFSProvider(zipPath string) (*ZipFSProvider, error)\n```\nNewZipFSProvider creates a new ZipFSProvider for the given zip file path.\n\n```go\nfunc (p *ZipFSProvider) Close() error\n```\nClose releases resources held by the zip reader.\n\n```go\nfunc (p *ZipFSProvider) Open(name string) (fs.File, error)\n```\nOpen opens the named file from the zip archive. If a strip prefix is configured, it prepends the prefix to the requested path. For example, with stripPrefix=\"/dist\", requesting \"/assets/style.css\" will open \"/dist/assets/style.css\" from the zip filesystem.\n\n```go\nfunc (p *ZipFSProvider) Path() string\n```\nPath returns the absolute path to the zip file being served.\n\n```go\nfunc (p *ZipFSProvider) Reload() error\n```\nReload reopens the zip file to pick up any changes. This is useful in development when the zip file is updated.\n\n```go\nfunc (p *ZipFSProvider) StripPrefix() string\n```\nStripPrefix returns the configured strip prefix.\n\n```go\nfunc (p *ZipFSProvider) Type() string\n```\nType returns \"zip\".\n\n```go\nfunc (p *ZipFSProvider) WithStripPrefix(prefix string)\n```\nWithStripPrefix sets the prefix to strip from requested paths. For example, WithStripPrefix(\"/dist\") will make files at \"/dist/assets\" accessible via \"/assets\".\n\n","path":"github.com/bitechdev/ResolveSpec/pkg/server/staticweb/providers","name":"providers","synopsis":"","isRedistributable":true}
