<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=Legacy%3AFunctions%2FFiles</id>
	<title>Legacy:Functions/Files - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.spheredev.org/index.php?action=history&amp;feed=atom&amp;title=Legacy%3AFunctions%2FFiles"/>
	<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Legacy:Functions/Files&amp;action=history"/>
	<updated>2026-11-08T01:12:41Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Legacy:Functions/Files&amp;diff=490&amp;oldid=prev</id>
		<title>Apollolux: /* Files */ removed GetFileList, updated</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Legacy:Functions/Files&amp;diff=490&amp;oldid=prev"/>
		<updated>2013-05-22T17:46:30Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Files: &lt;/span&gt; removed GetFileList, updated&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 17:46, 22 May 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Files ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Files ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RemoveFile&lt;/del&gt;|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RemoveFile&lt;/del&gt;]]&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&#039;&#039;filename&#039;&#039;)&lt;/del&gt;: &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Deletes a &lt;/del&gt;file.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Sphere &lt;/ins&gt;[[API:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;File&lt;/ins&gt;|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;File&lt;/ins&gt;]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;object is a handle to an [http&lt;/ins&gt;:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;//en.wikipedia.org/wiki/INI_file INI-like] key=value structured text &lt;/ins&gt;file.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GetFileList&lt;/del&gt;|&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;GetFileList&lt;/del&gt;]]&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;(&#039;&#039;directory&#039;&#039;): Gets an array of strings containing the filenames in &#039;directory&#039;&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Sphere &lt;/ins&gt;[[API:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RawFile&lt;/ins&gt;|&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;RawFile&lt;/ins&gt;]] &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;object is a handle to a raw file with no inference as to structure and by default processes as binary; scripts have been written to process RawFiles according to their proper formats&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenFile|OpenFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039;): Returns a Sphere [[API:File|File]] object with the filename.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenFile|OpenFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039;): Returns a Sphere [[API:File|File]] object with the filename.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenRawFile|OpenRawFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039; [, &amp;#039;&amp;#039;writeable&amp;#039;&amp;#039;]): Open or create a file, and grab a [[API:RawFile|RawFile]] handle to it.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenRawFile|OpenRawFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039; [, &amp;#039;&amp;#039;writeable&amp;#039;&amp;#039;]): Open or create a file, and grab a [[API:RawFile|RawFile]] handle to it.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Apollolux</name></author>
	</entry>
	<entry>
		<id>http://wiki.spheredev.org/index.php?title=Legacy:Functions/Files&amp;diff=474&amp;oldid=prev</id>
		<title>Apollolux: created</title>
		<link rel="alternate" type="text/html" href="http://wiki.spheredev.org/index.php?title=Legacy:Functions/Files&amp;diff=474&amp;oldid=prev"/>
		<updated>2013-05-22T17:29:07Z</updated>

		<summary type="html">&lt;p&gt;created&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Files ==&lt;br /&gt;
&lt;br /&gt;
* [[API:RemoveFile|RemoveFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039;): Deletes a file.&lt;br /&gt;
* [[API:GetFileList|GetFileList]](&amp;#039;&amp;#039;directory&amp;#039;&amp;#039;): Gets an array of strings containing the filenames in &amp;#039;directory&amp;#039;.&lt;br /&gt;
* [[API:OpenFile|OpenFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039;): Returns a Sphere [[API:File|File]] object with the filename.&lt;br /&gt;
* [[API:OpenRawFile|OpenRawFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039; [, &amp;#039;&amp;#039;writeable&amp;#039;&amp;#039;]): Open or create a file, and grab a [[API:RawFile|RawFile]] handle to it.&lt;br /&gt;
&lt;br /&gt;
=== File object ===&lt;br /&gt;
&lt;br /&gt;
* [[API:File/read|File.read]](key, default): reads a value from the key; the value type returned depends on the default value:&lt;br /&gt;
**	if the default is a number, read will return a number.&lt;br /&gt;
**	if the default is a text or string, read will return a string.&lt;br /&gt;
**	if the default is a boolean, read will return a boolean&lt;br /&gt;
**	if the key is not present in the file, it will return the default value.&lt;br /&gt;
* [[API:File/write|File.write]](key, value): writes a value (string, number, boolean) to the file under the key name&lt;br /&gt;
* [[API:File/flush|File.flush]](): writes the file to disk immediately; this way you don&amp;#039;t have to wait for it to save when the file object is garbage collected&lt;br /&gt;
* [[API:File/close|File.close]](): closes the File object, after which it cannot be used anymore.&lt;br /&gt;
*:	Always remember to close opened files.&lt;br /&gt;
&lt;br /&gt;
==== File keys ====&lt;br /&gt;
&lt;br /&gt;
* [[API:File/getNumKeys|File.getNumKeys]](): returns the number of keys in the file&lt;br /&gt;
* [[API:File/getKey|File.getKey]](index): returns a string of the key at &amp;#039;index&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== RawFile object ===&lt;br /&gt;
&lt;br /&gt;
* [[API:RawFile/read|RawFile.read]](&amp;#039;&amp;#039;num_bytes&amp;#039;&amp;#039;): Read &amp;#039;&amp;#039;num_bytes&amp;#039;&amp;#039; from the file, and return that data as a [[API:ByteArray|ByteArray]].&lt;br /&gt;
* [[API:RawFile/write|RawFile.write]](&amp;#039;&amp;#039;byte_array&amp;#039;&amp;#039;): Write the data in &amp;#039;&amp;#039;byte_array&amp;#039;&amp;#039; into the file.&lt;br /&gt;
* [[API:RawFile/close|RawFile.close]](): Close (and flush) the [[API:RawFile|RawFile]] object.&lt;br /&gt;
&lt;br /&gt;
==== Size ====&lt;br /&gt;
&lt;br /&gt;
* [[API:RawFile/getSize|RawFile.getSize]](): Get the size of the file in bytes.&lt;br /&gt;
&lt;br /&gt;
==== File pointer position ====&lt;br /&gt;
&lt;br /&gt;
* [[API:RawFile/getPosition|RawFile.getPosition]](): Get the current position which the data is read from.&lt;br /&gt;
* [[API:RawFile/setPosition|RawFile.setPosition]](&amp;#039;&amp;#039;position&amp;#039;&amp;#039;): Set the position that the file will be read from.&lt;br /&gt;
&lt;br /&gt;
==== Hashing raw files ====&lt;br /&gt;
&lt;br /&gt;
* [[API:HashFromFile|HashFromFile]](&amp;#039;&amp;#039;filename&amp;#039;&amp;#039;): Generate the MD5 &amp;#039;fingerprint&amp;#039; of a file. Identical files produce the same MD5 hash.&lt;/div&gt;</summary>
		<author><name>Apollolux</name></author>
	</entry>
</feed>