Difference between revisions of "MiniFS"
m |
(examples) |
||
Line 3: | Line 3: | ||
{{#set:Keyword=Filesystem}} | {{#set:Keyword=Filesystem}} | ||
MiniFS is a small but powerful module for easy filesystem access. It uses LuaFileSystem, the Lua standard I/O module and the standard OS module to form a convenient API. | MiniFS is a small but powerful module for easy filesystem access. It uses LuaFileSystem, the Lua standard I/O module and the standard OS module to form a convenient API. | ||
+ | |||
+ | MiniFS is written in MoonScript, a language that compiles to Lua. There is a pre-compiled version in the repository if you don't want to embed Moonscript in your Lua programs. | ||
You can grab it from [http://gitlab.com/zatherz/minifs GitLab]. Documentation of the module can be seen [https://zatherz.gitlab.io/minifs here]. | You can grab it from [http://gitlab.com/zatherz/minifs GitLab]. Documentation of the module can be seen [https://zatherz.gitlab.io/minifs here]. | ||
+ | |||
+ | == Examples == | ||
+ | === Moonscript === | ||
+ | <source lang="coffeescript"> | ||
+ | fs = require "minifs" | ||
+ | fs.mkdir("test") | ||
+ | fs.write("test/test.txt", "Hello") | ||
+ | fs.mkdir("test/test2") | ||
+ | fs.move("test/test.txt", "test/test2/test.txt") | ||
+ | fs.usetmp((path) -> | ||
+ | print(path) | ||
+ | ) | ||
+ | fs.rmdir("test", true) | ||
+ | </source> | ||
+ | |||
+ | === Lua === | ||
+ | <source lang="lua"> | ||
+ | fs = require "minifs" | ||
+ | fs.mkdir("test") | ||
+ | fs.write("test/test.txt", "Hello") | ||
+ | fs.mkdir("test/test2") | ||
+ | fs.move("test/test.txt", "test/test2/test.txt") | ||
+ | fs.usetmp(function(path) | ||
+ | print(path) | ||
+ | end) | ||
+ | fs.rmdir("test", true) | ||
+ | </source> | ||
[[Category:Libraries]] | [[Category:Libraries]] |
Revision as of 21:36, 20 May 2016
MiniFS is a small but powerful module for easy filesystem access. It uses LuaFileSystem, the Lua standard I/O module and the standard OS module to form a convenient API.
MiniFS is written in MoonScript, a language that compiles to Lua. There is a pre-compiled version in the repository if you don't want to embed Moonscript in your Lua programs.
You can grab it from GitLab. Documentation of the module can be seen here.
Examples
Moonscript
fs = require "minifs"
fs.mkdir("test")
fs.write("test/test.txt", "Hello")
fs.mkdir("test/test2")
fs.move("test/test.txt", "test/test2/test.txt")
fs.usetmp((path) ->
print(path)
)
fs.rmdir("test", true)
Lua
fs = require "minifs"
fs.mkdir("test")
fs.write("test/test.txt", "Hello")
fs.mkdir("test/test2")
fs.move("test/test.txt", "test/test2/test.txt")
fs.usetmp(function(path)
print(path)
end)
fs.rmdir("test", true)