marine-rs-sdk icon indicating copy to clipboard operation
marine-rs-sdk copied to clipboard

to_host_path: function to convert service path to host path via mappedDirs

Open folex opened this issue 3 years ago • 0 comments

Consider this use-case:

/tmp => /.fluence/v1/services/workdir/5c911af0-0e22-4a6c-bdd2-c6a376e2cf69/tmp
/tmp/vault => /.fluence/v1/stepper/particles/vault

I want to download file via curl or ipfs and specify output to /tmp/vault/XXX.

So I want to do

let cmd = ["-o", to_host_path("/tmp/vault/XXX")]
curl(cmd)

Please note that /tmp/ and /tmp/vault share the same prefix. So to_host_path should choose the longest prefix.

folex avatar Jul 01 '21 21:07 folex