File system operations include reading/writing files and directories. It can also include manipulating file attributes, file locking, symbolic linking, and manipulating the current working directory. Manipulating file system path names may also be included but may involve only string processing rather than OS calls. The following libraries provide these operations in Lua:
- Standard API
- [Lua I/O Library] - a standard library in Lua, includes basic file operations from ANSI C. It lacks operations not provided by ANSI C like listing directories.
- [os.execute] and [io.popen] Lua standard library functions - can be used to invoke file system operations provided by the OS shell on Windows or POSIX, but different commands are required for both platforms. Performance and error handling may be inferior with this approach. LuaRocks/LuaDist fall back to this when Lua
System is not available or is not sufficient.
- Small, focused file system libraries
- [LuaFileSystem] - Windows and POSIX implementations. Widely used, such as in LuaRocks/LuaDist. Originated from Kepler.
- [lua-fs] - basic file system operations. API looks roughly like Lua
System but lacks Windows support and is lesser known. LGPL license. (Steve Kemp)
- Systems libraries with file system operations
- [lposix] - fairly straightforward POSIX binding, supporting file system operations and other system related functions. (LuizHenriqueDeFigueiredo)
- [Win32 API wrappers] - has thin wrappers around Windows API functions, including file system operations. (Daniel Quintela)
- ExtensionProposal - Includes Windows and POSIX implementations mostly borrowed from Lua
System. Also includes other system related functions. (MarkEdgar)
- [LuaSys] - Windows and POSIX implementations of file system operations. Also includes other system related modules. (Nodir Temirhodzhaev)
- [nixio] - Includes Windows and POSIX implementations of file system operations. Has large file support and other system related modules. Now part of openwrt [Comparison to LuaFileSystem]. Apache 2 license. (Steven Barth)
- [Emilua] - An abstraction for OS resources with focus on IO and concurrency. It exposes C++17's filesystem library to Lua programs. Therefore it offers cross-platform logical path manipulations, algorithms, UTF-8, APIs, etc.
- [Grunt] - Supports the Windows shell object hierarchy. Part of a graphical scripting system for Windows. (JohnHind)
- [wxLua] wraps wxFile and other file system classes.
- LuaApr wraps the [Apache Portable Runtime] to provide a more comprehensive operating system interface. (PeterOdding)
- General bindings to platforms supporting file system operations
- Utility and specialty libraries
- [Penlight] - includes file system operations and path manipulations implemented in terms of pure Lua and LuaFileSystem (SteveDonovan)
- [lua-shellscript] - effort to abstract file system and path operations (and other shell operations) in platform neutral way. Based partly on Penlight and LuaRocks file system sub-libraries.
- FileGlob - pure Lua implementation of file globbing patterns. Used, for example, in SciteExtMan. (DavidManura)
- [luafuse] - Lua binding to FUSE, a Linux library for creating file systems in userspace. (Gary Ng)
Sometimes file system operations are bundled together with more general systems related functions (see ExtendedApi and LibrariesAndBindings).
RecentChanges · preferences
edit · history
Last edited April 5, 2023 1:24 pm GMT (diff)