<?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-05-10T13:41:07Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.29.0</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 dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Files: &lt;/span&gt; removed GetFileList, updated&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; 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='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Files ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; 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='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;RemoveFile&lt;/del&gt;|&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;RemoveFile&lt;/del&gt;]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(''filename'')&lt;/del&gt;: &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Deletes a &lt;/del&gt;file.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;Sphere &lt;/ins&gt;[[API:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;File&lt;/ins&gt;|&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;File&lt;/ins&gt;]] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;object is a handle to an [http&lt;/ins&gt;:&lt;ins class=&quot;diffchange diffchange-inline&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='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;GetFileList&lt;/del&gt;|&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;GetFileList&lt;/del&gt;]]&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;(''directory''): Gets an array of strings containing the filenames in 'directory'&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;Sphere &lt;/ins&gt;[[API:&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;RawFile&lt;/ins&gt;|&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;RawFile&lt;/ins&gt;]] &lt;ins class=&quot;diffchange diffchange-inline&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='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenFile|OpenFile]](''filename''): Returns a Sphere [[API:File|File]] object with the filename.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenFile|OpenFile]](''filename''): 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='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenRawFile|OpenRawFile]](''filename'' [, ''writeable'']): Open or create a file, and grab a [[API:RawFile|RawFile]] handle to it.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [[API:OpenRawFile|OpenRawFile]](''filename'' [, ''writeable'']): 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]](''filename''): Deletes a file.&lt;br /&gt;
* [[API:GetFileList|GetFileList]](''directory''): Gets an array of strings containing the filenames in 'directory'.&lt;br /&gt;
* [[API:OpenFile|OpenFile]](''filename''): Returns a Sphere [[API:File|File]] object with the filename.&lt;br /&gt;
* [[API:OpenRawFile|OpenRawFile]](''filename'' [, ''writeable'']): 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'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 'index'&lt;br /&gt;
&lt;br /&gt;
=== RawFile object ===&lt;br /&gt;
&lt;br /&gt;
* [[API:RawFile/read|RawFile.read]](''num_bytes''): Read ''num_bytes'' from the file, and return that data as a [[API:ByteArray|ByteArray]].&lt;br /&gt;
* [[API:RawFile/write|RawFile.write]](''byte_array''): Write the data in ''byte_array'' 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]](''position''): 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]](''filename''): Generate the MD5 'fingerprint' of a file. Identical files produce the same MD5 hash.&lt;/div&gt;</summary>
		<author><name>Apollolux</name></author>	</entry>

	</feed>