Function win32

  • Get a new instance of PathNice or PathNiceArr.

    If the argurment is a string or a PathNice, a PathNice is returned. A PathNice instance is a wrapper of the raw path string, so that the path can be easily used to generate additional paths or manipulate files.

    If there are more than 1 arguments or the only argument is an Array, a PathNiceArr is returned. The class PathNiceArr extends the base class Array, adding methods for copying, moving, removing, watching files in a holistic manner.

    For details, please refer to the documents of PathNice and PathNiceArr.

    Example

    Get a PathNice instance:

    $ let src: PathNice = path('./src')
    

    Get the raw path string from PathNice:

    $ src.raw
    './src'

    Use src to generate another path:

    $ src.join('index.ts')
    PathNice { raw: 'src/index.ts' } // on POSIX
    PathNice { raw: 'src\\index.ts' } // on Windows

    Use src to write a file:

    $ src.join('index.ts').writeFile('export default 42;')
    Promise { <pending> ... }

    Get a PathNiceArr instance:

    let arr = path('./README.md', './package.json', './tsconfig.json');
    

    Filter json files from the array and copy to another folder:

    arr.filter(f => f.ext() === '.json')
    .copyToDir('./config')

    Type Parameters

    • T extends string

    Parameters

    • path: T

    Returns PathNice<T>

  • Type Parameters

    • T extends string

    Parameters

    Returns PathNice<T>

  • Parameters

    • path_0: string | PathNice<unknown>
    • path_1: string | PathNice<unknown>
    • Rest ...paths_rest: (string | PathNice<unknown>)[]

    Returns PathNiceArr

  • Parameters

    Returns PathNiceArr

Generated using TypeDoc