So yea I just learned how to pipe a powershell variable into a nodejs script.
(base) @Carl ➜ my-pwsh-deps git(main> $str = './README.md'
(base) @Carl ➜ my-pwsh-deps git(main) node -p @"
>> const path = require('path')
>> let s = ``$str``
>> console.log(path.parse(path.resolve(s)))
>> "@
{
root: 'C:\\',
dir: 'C:\\Users\\Carl\\gitstuff\\my-pwsh-deps',
base: 'README.md',
ext: '.md',
name: 'README'
}
It's kind of similar to when you see a slice of perl
code inside a bash
script. Pretty cool.
Top comments (0)