CreateThumb creates a new thumb image for the file at originalKey location. The new thumb file is stored at thumbKey location.
thumbSize is in the format:
GetReuploadableFile constructs a new reuploadable File value from the associated fileKey blob.Reader.
If preserveName is false then the returned File.Name will have a new randomly generated suffix, otherwise it will reuse the original one.
This method could be useful in case you want to clone an existing Record file and assign it to a new Record (e.g. in a Record duplicate action).
If you simply want to copy an existing file to a new location you could check the Copy(srcKey, dstKey) method.
Checks if the provided dir prefix doesn't have any files.
A trailing slash will be appended to a non-empty dir string argument to ensure that the checked prefix is a "directory".
Returns "false" in case it has at least one file, otherwise - "true".
List returns a flat list with info for all files under the specified prefix.
NewWriter returns a new blob.Writer instance allowing direct file create from an io.Reader value.
If a file with the specified fileKey already exists, it will be replaced.
NB! Make sure to call Close() on the resulting writer after you are done working with it.
Note: If you have a bytes slice, [filesystem.File], or a multipart header value, you can check also the Upload* related methods as they are more user-friendly.
Example:
content := strings.NewReader("Lorem ipsum dolor sit amet...")
fsys, _ := filesystem.NewLocal("dir")
defer fsys.Close()
w, _ := fsys.NewWriter("example/file/key", nil)
w.ReadFrom(content)
w.Close()
OnDelete is a low level hook that is triggered on every [System.Delete] call.
Note that the hook doesn't fire when a file is being overwritten by a new one, because in that case [System.Delete] is not invoked.
OnNewWriter is a low level hook that is triggered on every new writer initialization (aka. when attempting to create a new file with [system.NewWriter] or [system.Upload]).
Note that currently it doesn't trigger on [System.Copy] but this may change in future releases.
Serve serves the file at fileKey location to an HTTP response.
If the download query parameter is used the file will be always served for
download no matter of its type (aka. with "Content-Disposition: attachment").
Internally this method uses [http.ServeContent] so Range requests, If-Match, If-Unmodified-Since, etc. headers are handled transparently.
UploadFile uploads the provided File to the fileKey location.
UploadMultipart uploads the provided multipart file to the fileKey location.
Generated using TypeDoc
Attributes returns the attributes for the file with fileKey path.
If the file doesn't exist it returns ErrNotFound.