diff --git a/docs/workflows/reference/_category_.yml b/docs/workflows/reference/_category_.yml new file mode 100644 index 0000000..4d35a5a --- /dev/null +++ b/docs/workflows/reference/_category_.yml @@ -0,0 +1,2 @@ +label: Reference +position: 3 diff --git a/docs/workflows/reference/loaders.md b/docs/workflows/reference/loaders.md new file mode 100644 index 0000000..ba85ba3 --- /dev/null +++ b/docs/workflows/reference/loaders.md @@ -0,0 +1,85 @@ +# Loaders + +In addition to those provided by [rdf-loader-code](https://npm.im/rdf-loader-code), +the `barnard59-core` package provides additional loaders to simplify the definition of pipelines. + +## `p:Pipeline` + +TBD + +## `p:Variable(Name)` + +TBD + +## `p:FileContents` + +Reads file from a given path and returns its raw contents. + +:::note +`p:FileContents` is a literal node +::: + +:::caution + +This loader may not be suitable for loading large files because they are synchronously put into memory + +::: + +### Basic usage + +```turtle +@prefix code: . +@prefix p: . + + + code:arguments + ( + "/full/path/myKeyFile.key"^^p:FileContent + ) +. +``` + +### Path in variable + +The `p:FileContent` literal can also be the name of a variable. + +```turtle +@prefix code: . +@prefix p: . + + + p:variables [ + p:variable [ p:name "KEY_PATH" ; p:value "/full/path/myKeyFile.key" ] ; + ] ; +. + + + code:arguments + ( + "KEY_PATH"^^p:FileContent + ) +. +``` + +### Home dir paths + +For convenience, bash-style paths stating with `~` are also supported. + +```turtle +@prefix code: . +@prefix p: . + + + a p:Step ; + code:implementedBy + [ + a code:EcmaScriptModule ; + code:link ; + ] ; + code:arguments + [ + code:name "privateKey" ; + code:value "~/.ssh/id_ed25519"^^p:FileContent ; + ] ; +. +```