If you are using the Solana CLI, it is possible to pass a keypair in from stdin without writing it to a file first.
This can be demonstrated using any keypair file and doing:
$ cat my-keypair.json | solana --keypair stdin:// address
<your-address-will-appear-here>
As you can see, it just expects a byte-array, one that is identical to the contents of a typical keypair file, not a Base58 string.
Now, if I understand you correctly, you have some program that calls the Solana CLI as a subprocess, and you want to pass in the private key. As per the above, you can convert your Base58 representation of your private key into a JSON string of a byte array (e.g. [234, 10, 56, 42 ...]
, and then you can pass that string into stdin of your subprocess.
stdin
for feeding keypairs into the solana CLI.