github.com/jfrog/frogbot@v1.1.1-0.20231221090046-821a26f50338/action/node_modules/@actions/io/README.md (about)

     1  # `@actions/io`
     2  
     3  > Core functions for cli filesystem scenarios
     4  
     5  ## Usage
     6  
     7  #### mkdir -p
     8  
     9  Recursively make a directory. Follows rules specified in [man mkdir](https://linux.die.net/man/1/mkdir) with the `-p` option specified:
    10  
    11  ```js
    12  const io = require('@actions/io');
    13  
    14  await io.mkdirP('path/to/make');
    15  ```
    16  
    17  #### cp/mv
    18  
    19  Copy or move files or folders. Follows rules specified in [man cp](https://linux.die.net/man/1/cp) and [man mv](https://linux.die.net/man/1/mv):
    20  
    21  ```js
    22  const io = require('@actions/io');
    23  
    24  // Recursive must be true for directories
    25  const options = { recursive: true, force: false }
    26  
    27  await io.cp('path/to/directory', 'path/to/dest', options);
    28  await io.mv('path/to/file', 'path/to/dest');
    29  ```
    30  
    31  #### rm -rf
    32  
    33  Remove a file or folder recursively. Follows rules specified in [man rm](https://linux.die.net/man/1/rm) with the `-r` and `-f` rules specified.
    34  
    35  ```js
    36  const io = require('@actions/io');
    37  
    38  await io.rmRF('path/to/directory');
    39  await io.rmRF('path/to/file');
    40  ```
    41  
    42  #### which
    43  
    44  Get the path to a tool and resolves via paths. Follows the rules specified in [man which](https://linux.die.net/man/1/which).
    45  
    46  ```js
    47  const exec = require('@actions/exec');
    48  const io = require('@actions/io');
    49  
    50  const pythonPath: string = await io.which('python', true)
    51  
    52  await exec.exec(`"${pythonPath}"`, ['main.py']);
    53  ```