mirror of
https://github.com/gogrlx/docs.grlx.dev.git
synced 2026-04-02 03:08:53 -07:00
added reference to the file provider interface
This commit is contained in:
@@ -2,7 +2,17 @@
|
||||
title: grlx.ingedients.file.providers
|
||||
description: grlx built-in file providers
|
||||
---
|
||||
`grlx` has a concept of file providers for different ways that you might obtain a file to be added to a given `sprout`. This uses a provider interface to keep this extensible and provide a standard way to use different file types. By default, `grlx` has three built-in providers: local, HTTP, and S3.
|
||||
`grlx` has a concept of file providers for different ways that you might obtain a file to be added to a given `sprout`. This uses a provider interface to keep this extensible and provide a standard way to use different file types. The `go` interface for File Providers looks like the following:
|
||||
```go
|
||||
type FileProvider interface {
|
||||
Download(context.Context) error
|
||||
Properties() (map[string]interface{}, error)
|
||||
Parse(id, source, destination, hash string, properties map[string]interface{}) (FileProvider, error)
|
||||
Protocols() []string
|
||||
Verify(context.Context) (bool, error)
|
||||
}
|
||||
```
|
||||
By default, `grlx` has three built-in providers: local, HTTP, and S3.
|
||||
|
||||
## Local
|
||||
The local provider would be how you would use a file from your host system.
|
||||
@@ -14,7 +24,7 @@ file.cached:
|
||||
```
|
||||
|
||||
## HTTP
|
||||
The HTTP provider allows you to download files via HTTP for use. The [example](/ingredients/file-providers/#example) below is using the HTTP provider to download Go from the Internet. This file then gets cached to the sprout.
|
||||
The HTTP provider allows you to download files via HTTP for use. The [example](/ingredients/file-providers/#example) below is using the HTTP provider to download Go from the Internet. This file then gets cached to the sprout.
|
||||
#### Example
|
||||
```yaml
|
||||
file.cached:
|
||||
|
||||
Reference in New Issue
Block a user