Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load files from the local file system as arguments #31

Closed
bergos opened this issue Nov 25, 2019 · 1 comment · Fixed by #126
Closed

Load files from the local file system as arguments #31

bergos opened this issue Nov 25, 2019 · 1 comment · Fixed by #126

Comments

@bergos
Copy link

bergos commented Nov 25, 2019

In some cases it would be useful to read the content of files on the local file system. For example a ssh key can be loaded like this:

"${require('fs').readFileSync('/full/path/myKeyFile.key').toString()}"^^code:EcmaScriptTemplateLiteral

But it would be useful to have a datatype + loader that handles it:

"/full/path/myKeyFile.key"^^p:FileContent

It should also work with variables:

"keyFilename"^^p:VariableFileContent
tpluscode pushed a commit that referenced this issue Jun 20, 2023
Explicit typed stream interfaces
@tpluscode
Copy link
Contributor

This could also be implemented as as stream itself. The SHACL validation step does that to load the shapes graph. That is not as nice as a synchronous loader to plug in directly to the function but avoids the risk of loading large files to memory

The problem of using a pipeline is verbosity, requiring a more complex setup. Given the original example

<step>
  a :Step ;
  code:arguments (
    <loadStepFile>
  ) ;
.

<loadStepFile> a :Pipeline, :Readable ;
  :steps [ :stepList (
    [ 
      code:implementedBy [ code:link <node:fs#createReadStream> ] ;
      code:arguments ( "/full/path/myKeyFile.key" )
    ] 
  ) ] ;
.

Hypothetically, #85 could be a solution, where the <loadStepFile> becomes a reusable building block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants