Archived
1
0

Add binary extraction

I temporarily removed this during the refactor so it needed to be added
back. This time I bundled it with the nbin loader code since it's all
related (will also make it easier to remove).
This commit is contained in:
Asher
2020-02-19 14:08:22 -06:00
parent b9e7a3daa7
commit 51a5c77cb8
2 changed files with 51 additions and 35 deletions

View File

@ -151,19 +151,6 @@ export const open = async (url: string): Promise<void> => {
})
}
/**
* Extract a file to the temporary directory and make it executable. This is
* required since we can't execute binaries stored within our binary.
*/
export const unpackExecutables = async (filePath: string): Promise<void> => {
const destination = path.join(tmpdir, "binaries", path.basename(filePath))
if (filePath && !(await util.promisify(fs.exists)(destination))) {
await fs.mkdirp(tmpdir)
await fs.writeFile(destination, await fs.readFile(filePath))
await util.promisify(fs.chmod)(destination, "755")
}
}
/**
* For iterating over an enum's values.
*/