HEX
Server: nginx/1.24.0
System: Linux nowruzgan 6.8.0-57-generic #59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
User: babak (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: /var/dev/nowruzgan/rest/node_modules/machinepack-fs/machines/exists.js
module.exports = {


  friendlyName: 'Exists?',


  description: 'Check whether a file or directory exists at the given path.',


  cacheable: true,


  inputs: {

    path: {
      example: '/Users/mikermcneil/.tmp/foo',
      description: 'The absolute path to the file or directory',
      required: true
    }

  },


  exits: {

    doesNotExist: {
      description: 'The specified path is empty'
    },

    success: {
      description: 'A file or directory exists at the specified path'
    }

  },

  fn: function (inputs, exits) {

    var Path = require('path');
    var fsx = require('fs-extra');

    fsx.exists(Path.resolve(process.cwd(),inputs.path), function(exists) {
      if (!exists) {return exits.doesNotExist();}
      return exits.success();
    });
  }


};