<doc>
  <legacy_id>1516</legacy_id>
  <name>diskSpace</name>
  <type>function</type>
  <syntax>
    <example>the diskSpace</example>
    <example>diskSpace()</example>
  </syntax>
  <library></library>
  <objects>
  </objects>
  <synonyms>
  </synonyms>
  <classification>
    <category>The System Environment</category>
  </classification>
  <references>
    <function tag="stackSpace">stackSpace Function</function>
    <function tag="hasMemory">hasMemory Function</function>
    <function tag="volumes">volumes Function</function>
    <property tag="freeSize">freeSize Property</property>
    <property tag="size">size Property</property>
  </references>
  <history>
    <introduced version="1.0">Added.</introduced>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
  </classes>
  <security>
    <disk access="???"/>
  </security>
  <summary><glossary tag="return">Returns</glossary> the amount of free space on the disk that holds the <property tag="defaultFolder">defaultFolder</property>.</summary>
  <examples>
    <example>the diskSpace</example>
    <example>put the diskSpace div (1024^2) into megabytesAvailable</example>
    <example>if the diskSpace &amp;lt; spaceNeeded then exit mouseUp</example>
  </examples>
  <description>
    <p>Use the <b>diskSpace</b> <control_st tag="function">function</control_st> to determine whether there is enough free space to complete an action (such as <glossary tag="download">downloading</glossary> data).</p><p/><p><b>Value:</b></p><p>The <b>diskSpace</b> <control_st tag="function">function</control_st> <glossary tag="return">returns</glossary> an <keyword tag="integer">integer</keyword>.</p><p/><p><b>Comments:</b></p><p>The value returned by the <b>diskSpace</b> <control_st tag="function">function</control_st> is in <glossary tag="byte">bytes</glossary>. To convert to kilobytes (K), divide the <glossary tag="return value">return value</glossary> by 1024. To convert to megabytes (M), divide by 1024^2. To convert to gigabytes (G), divide by 1024^3:</p><p/><p>  function humanReadableDiskSpace theUnits</p><p>    set the caseSensitive to false</p><p>    switch char 1 of theUnits</p><p>    case "k"</p><p>      return the diskSpace div 1024</p><p>      break</p><p>    case "m"</p><p>      return the diskSpace div (1024^2)</p><p>      break</p><p>    case "g"</p><p>      return the diskSpace div (1024^3)</p><p>      break</p><p>    default</p><p>      return the diskSpace</p><p>      break</p><p>    end switch</p><p>  end humanReadableDiskSpace</p>
  </description>
</doc>