index.js
function checkUnix(directoryPath) {
  if (!path.normalize(directoryPath).startsWith(path.sep)) {
    return new Promise((resolve, reject) => {
      reject(new InvalidPathError(`The following path is invalid (should start by ${path.sep}): ${directoryPath}`))
    })
  }

  return check(
    `df -Pk "${module.exports.getFirstExistingParentPath(directoryPath)}"`,
    () => true, // We should only get one line, so we did not need to filter
    {
      diskPath: 5,
      free: 3,
      size: 1
    },
    1024 // We get sizes in kB, we need to convert that to bytes
  )
}
function checkUnix(directoryPath) {
  if (!path.normalize(directoryPath).startsWith(path.sep)) {
    return new Promise((resolve, reject) => {
      reject(new InvalidPathError(`The following path is invalid (should start by ${path.sep}): ${directoryPath}`))
    })
  }

  return check(
    `df -Pk "${module.exports.getFirstExistingParentPath(directoryPath)}"`,
    () => true, // We should only get one line, so we did not need to filter
    {
      diskPath: 5,
      free: 3,
      size: 1
    },
    1024 // We get sizes in kB, we need to convert that to bytes
  )
}
function checkUnix ( directoryPath ) { if ( ! path . normalize ( directoryPath ) . startsWith ( path . sep ) ) { return new Promise ( ( resolve , reject ) => { reject ( new InvalidPathError ( ` ${ path . sep } ${ directoryPath } ` ) ) } ) } return check ( ` ${ module . exports . getFirstExistingParentPath ( directoryPath ) } ` , ( ) => true , // We should only get one line, so we did not need to filter { diskPath : 5 , free : 3 , size : 1 } , 1024 // We get sizes in kB, we need to convert that to bytes ) }
Build the check call for unix

@param {String} directoryPath - The file/folder path from where we want to know disk space
@return {Promise} -
Build the check call for unix