I have a pkg-packaged .exe I need to copy files out of - which I'm aware may not be possible - but surely there's some way to get the asset files out, right?
I'm quite confident that the assets are included in the pkg after I added this to my package.json:
"pkg": {
"assets": [
"assets/**/*"
]
},
and --config package.json to my pkg command.
But still, there doesn't seem to be any way to get files out of the executable besides, I guess, to store the files as strings and then write them to the disk (which seems, to me, madness.)
Is there some better way I'm overlooking? I guess Node's fs command can't read into the .exe in any way, but hopefully the .exe should be able to write the files out somewhere, somehow?
Does anyone know how?
TLDR: I'm looking to read, or ideally copy, assets out of the .exe
By the way: Vercel/pkg used to be known as Zeit/pkg
I was able to get this working with code like this:
At first I was hesitant to try this because I thought C:\snapshot may not be a reliable path if the user already had such a directory - and that some other path may be used - but that's not the case. C:\snapshot is virtual so there will never be a conflict with the real filesystem.