1
0
Fork 0
toolkit/packages/io
Thomas Boop 0d74e9080a
Re-enable the audit tools step and update dependencies (#815)
* update package versions

* run audit

* fix eslint config

* linter updates

* re-enable audit

* update timeouts test

* pass done into callback

* fix format
2021-05-21 09:19:40 -04:00
..
__tests__ Add option to cp to only copy contents of directory (#788) 2021-05-05 09:40:12 -04:00
src Re-enable the audit tools step and update dependencies (#815) 2021-05-21 09:19:40 -04:00
LICENSE.md Add License.md to all npm packages (#548) 2020-08-25 16:26:50 -04:00
README.md io/README.md 2019-08-21 01:18:21 -04:00
RELEASES.md Add findInPath method to locate all matching executables in the system path (#609) 2021-04-02 12:22:30 -04:00
package-lock.json Add findInPath method to locate all matching executables in the system path (#609) 2021-04-02 12:22:30 -04:00
package.json Add findInPath method to locate all matching executables in the system path (#609) 2021-04-02 12:22:30 -04:00
tsconfig.json Add io (#5) 2019-05-22 16:05:34 -04:00

README.md

@actions/io

Core functions for cli filesystem scenarios

Usage

mkdir -p

Recursively make a directory. Follows rules specified in man mkdir with the -p option specified:

const io = require('@actions/io');

await io.mkdirP('path/to/make');

cp/mv

Copy or move files or folders. Follows rules specified in man cp and man mv:

const io = require('@actions/io');

// Recursive must be true for directories
const options = { recursive: true, force: false }

await io.cp('path/to/directory', 'path/to/dest', options);
await io.mv('path/to/file', 'path/to/dest');

rm -rf

Remove a file or folder recursively. Follows rules specified in man rm with the -r and -f rules specified.

const io = require('@actions/io');

await io.rmRF('path/to/directory');
await io.rmRF('path/to/file');

which

Get the path to a tool and resolves via paths. Follows the rules specified in man which.

const exec = require('@actions/exec');
const io = require('@actions/io');

const pythonPath: string = await io.which('python', true)

await exec.exec(`"${pythonPath}"`, ['main.py']);