Function existsSync

  • Returns true if the path exists, false otherwise.

    For detailed information, see the documentation of the asynchronous version of this API: exists.

    fs.exists() is deprecated, but fs.existsSync() is not. The callbackparameter to fs.exists() accepts parameters that are inconsistent with other Node.js callbacks. fs.existsSync() does not use a callback.

    import { existsSync } from 'fs';

    if (existsSync('/etc/passwd'))
    console.log('The path exists.');

    Since

    v0.0.67

    Parameters

    • path: PathLike

    Returns boolean

  • Returns true if the path exists, false otherwise.

    For detailed information, see the documentation of the asynchronous version of this API: exists.

    fs.exists() is deprecated, but fs.existsSync() is not. The callbackparameter to fs.exists() accepts parameters that are inconsistent with other Node.js callbacks. fs.existsSync() does not use a callback.

    import { existsSync } from 'fs';

    if (existsSync('/etc/passwd'))
    console.log('The path exists.');

    Since

    v0.0.67

    Parameters

    • path: PathLike

    Returns boolean

Generated using TypeDoc