Difference between revisions of "File"
Jump to navigation
Jump to search
(Created page with "The <c>file</c> module provides access to disk files in both Mini Micro and command-line MiniScript. == Methods and Properties == The following table shows methods...") |
m |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | The <c>file</c> module provides access to disk files in | + | The <c>file</c> module provides access to disk files in [[Mini Micro]], [[Soda]], [[command-line MiniScript]], and [[Farmtronics]]. |
== Methods and Properties == | == Methods and Properties == | ||
− | The following table shows methods available in | + | The following table shows methods available in all environments ([[Mini Micro]], [[Soda]], [[command-line MiniScript]], and [[Farmtronics]]). |
{| class="wikitable" | {| class="wikitable" | ||
Line 36: | Line 36: | ||
| [[file.readLines]] ''path'' || read whole content of file as a list of strings | | [[file.readLines]] ''path'' || read whole content of file as a list of strings | ||
|- | |- | ||
− | | [[file.writeLines]] ''path'' || write a list of strings to a text file, separated by line breaks | + | | [[file.writeLines]] ''path'', ''lines'' || write a list of strings to a text file, separated by line breaks |
+ | |- | ||
+ | | [[file.open]] ''path'', ''[mode="rw+"]'' || open a file for further processing | ||
|} | |} | ||
− | The following table shows methods available only in [[Mini Micro]]. | + | The following table shows methods available only in [[Mini Micro]] and/or [[Soda]]. |
{| class="wikitable" | {| class="wikitable" | ||
Line 59: | Line 61: | ||
| [[file.saveRaw]] ''path'', ''rawData'' || save a [[RawData]] object to a file | | [[file.saveRaw]] ''path'', ''rawData'' || save a [[RawData]] object to a file | ||
|} | |} | ||
+ | |||
+ | |||
+ | [[Category:Mini Micro]] | ||
+ | [[Category:Soda]] | ||
+ | [[Category:Command-Line MiniScript]] | ||
+ | [[Category:Farmtronics]] |
Latest revision as of 21:18, 29 January 2022
The file
module provides access to disk files in Mini Micro, Soda, command-line MiniScript, and Farmtronics.
Methods and Properties
The following table shows methods available in all environments (Mini Micro, Soda, command-line MiniScript, and Farmtronics).
Method or Property | Purpose |
---|---|
file.curdir | get the current working directory path |
file.setdir path | set the current working directory |
file.makedir path | create a new directory |
file.children [path] | get all file/subdirectory names of the given/current directory |
file.name path | get just the file name from a file path |
file.parent path | get the parent directory of a given path |
file.exists path | return 1 if a file or directory exists, 0 if not |
file.info path | get a map of details about a given file or directory |
file.child basePath, subpath | get a path to a file within a directory |
file.delete path | delete a file or (empty) directory |
file.move oldPath, newPath | move/rename a file or directory |
file.copy oldPath, newPath | copy a file to a new location |
file.readLines path | read whole content of file as a list of strings |
file.writeLines path, lines | write a list of strings to a text file, separated by line breaks |
file.open path, [mode="rw+"] | open a file for further processing |
The following table shows methods available only in Mini Micro and/or Soda.
Method or Property | Purpose |
---|---|
file.export path | export a file to the host file system |
file.import path | import a file from the host file system |
file.loadImage path | load an Image from a PNG, JPEG, or TGA file |
file.saveImage path, image, [quality=80] | save an Image to a file |
file.loadSound path | load a Sound from a WAV or OGG file |
file.loadRaw path | load binary data as a RawData object |
file.saveRaw path, rawData | save a RawData object to a file |