Skip to content

Commit

Permalink
docs: document file contents literal
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Aug 2, 2023
1 parent 99e3ba6 commit 40ba846
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/workflows/reference/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
label: Reference
position: 3
85 changes: 85 additions & 0 deletions docs/workflows/reference/loaders.md
Original file line number Diff line number Diff line change
@@ -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: <https://code.described.at/> .
@prefix p: <https://pipeline.described.at/> .
<step>
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: <https://code.described.at/> .
@prefix p: <https://pipeline.described.at/> .
<pipeline>
p:variables [
p:variable [ p:name "KEY_PATH" ; p:value "/full/path/myKeyFile.key" ] ;
] ;
.
<step>
code:arguments
(
"KEY_PATH"^^p:FileContent
)
.
```

### Home dir paths

For convenience, bash-style paths stating with `~` are also supported.

```turtle
@prefix code: <https://code.described.at/> .
@prefix p: <https://pipeline.described.at/> .
<step>
a p:Step ;
code:implementedBy
[
a code:EcmaScriptModule ;
code:link <node:barnard59-ftp/list.js#default> ;
] ;
code:arguments
[
code:name "privateKey" ;
code:value "~/.ssh/id_ed25519"^^p:FileContent ;
] ;
.
```

0 comments on commit 40ba846

Please sign in to comment.