This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 226
Expand file tree
/
Copy pathdiskSpace.lcdoc
More file actions
66 lines (48 loc) · 1.61 KB
/
diskSpace.lcdoc
File metadata and controls
66 lines (48 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
Name: diskSpace
Type: function
Syntax: the diskSpace
Syntax: diskSpace()
Summary:
<return|Returns> the amount of free space on the disk that holds the
<defaultFolder>.
Introduced: 1.0
OS: mac, windows, linux
Platforms: desktop, server
Security: disk
Example:
the diskSpace
Example:
put the diskSpace div (1024^2) into megabytesAvailable
Example:
if the diskSpace < spaceNeeded then exit mouseUp
Returns:
The <diskSpace> <function> <return|returns> an <integer>.
Description:
Use the <diskSpace> <function> to determine whether there is enough free
space to complete an action (such as <download|downloading> data).
The value returned by the <diskSpace> <function> is in <byte|bytes>. To
convert to kilobytes (K), divide the <return value> by 1024. To convert
to megabytes (M), divide by 1024^2. To convert to gigabytes (G), divide
by 1024^3:
function humanReadableDiskSpace theUnits
set the caseSensitive to false
switch char 1 of theUnits
case "k"
return the diskSpace div 1024
break
case "m"
return the diskSpace div (1024^2)
break
case "g"
return the diskSpace div (1024^3)
break
default
return the diskSpace
break
end switch
end humanReadableDiskSpace
References: function (control structure), hasMemory (function),
volumes (function), stackSpace (function), download (glossary),
return value (glossary), return (glossary), byte (glossary),
integer (keyword), freeSize (property), size (property),
defaultFolder (property)