nasal-library-file-system
БесплатноБез исполняемых скриптовНе проверенExplains the input/output (IO) file handling, property serialization, and directory-path manipulation methods in Nasal, combining raw stream operations ('io')…
от container32518 установок в других каталогахОб этом скилле
File System & Path Manipulation (io and os.path)
Nasal processes files via two distinct systems: the procedural raw byte/line file operations module (io) and the high-level object-oriented path utility wrapper (os.path).
Security Note: All file operations in FlightGear are constrained by security rules. Writing/deleting is normally permitted only within the $FG_HOME/Export/ directory.
Raw File Operations (io)
File Streams: Open, Close, and Flush
io.open(path[, mode]): Opens a file stream atpath. Returns aniofileghost object.modedefaults to"rb"(read binary).io.close(file): Flushes the stream buffer and closes the file pointer. Returnsnil.io.flush(file): Commits volatile cache buffers directly to the hard disk storage immediately without closing the stream descriptor.
| Mode | Purpose | Mode | Purpose (Binary) |
|---|---|---|---|
"r" |
Read-only (must exist) | "rb" |
Read-only binary |
"w" |
Write (truncates existing) | "wb" |
Write binary |
"a" |
Append (creates if missing) | "ab" |
Append binary |
"r+" |
Read/write (must exist) | "r+b" |
Read/write binary |
"w+" |
Read/write (truncates) | "w+b" |
Read/write binary |
"a+" |
Read/write append | "a+b" |
Read/write append binary |
Reading and Writing Data
io.readfile(path): Loads and returns an entire file as a single string. Throws a runtime exception on failure.io.readln(file): Reads a single line, automatically stripping trailingLF,CR, orCR+LFterminators. Returnsnilat EOF.io.read(file, buf, len): Reads exactlylenbytes into a pre-allocated byte-buffer object (initialized viabits.buf(size)). Returns the count of bytes successfully loaded.io.write(file, string): Writes raw string data to the stream buffer. Returns the count of bytes written.
var path = getprop("/sim/fg-home") ~ "/Export/output.txt";
# Writing data
var out = io.open(path, "w");
io.write(out, "Line 1\nLine 2\n");
io.close(out);
# Reading line-by-line
var instream = io.open(path, "r");
while ((var line = io.readln(instream)) != nil) {
print("Read: " ~ line);
}
io.close(instream);
File Location & Pointers
io.seek(file, offset, whence): Repositions the active cursor inside a stream relative towhence:io.SEEK_SET: Offset relative to file beginning (non-negative).io.SEEK_CUR: Offset relative to current cursor index.io.SEEK_END: Offset relative to end of file.io.tell(file): Returns the current cursor index position inside the stream.
Metadata & Path Utils
io.basename(path): Returns the final element of a path (e.g.,/a/b.xml$\rightarrow$"b.xml").io.dirname(path): Returns the parent directory container path containing a trailing slash.io.stat(path): Returns a 12-element file metadata vector (nilif missing). Indices:[7]is total size in bytes,[9]is modified timestamp,[11]is file type ("reg","dir","lnk", etc.).
Property Tree Serialization
Nasal allows fast saving and loading of the FlightGear Property Tree using XML formats:
io.read_properties(path[, target]): Parses a PropertyList XML directly into aprops.Nodecontainer. Iftargetis provided (node pointer or path string), the property hierarchy is integrated into that destination.io.write_properties(path, prop_node_or_path): Serializes a subset of the Property Tree directly to an XML file.io.readxml(path[, prefix]): Imports raw XML nodes (not strictly PropertyList format) where attributes map to subnodes named with the givenprefix(defaults to"___").io.writexml(path, node[, indent[, prefix]]): Serializes an arbitrary tree structure to raw XML.
# Export active position state directly to file
var path = getprop("/sim/fg-home") ~ "/Export/position-dump.xml";
io.write_properties(path, "/position");
High-Level Path Object (os.path)
The os.path utility manages path evaluations, file permissions, structural queries, and physical directory mutation operations.
Constructors & Mutation
os.path.new([path]): Instantiates a path object. Defaults to$FG_ROOT.os.path.desktop(): Returns a path object pointing directly to the active system desktop directory..set(path): Updates the underlying string path pointing context..append(part): Joins a directory element (ensuring correct platform directory separators are used)..concat(str): Merges raw characters to the end of the string without directory separators.
Status Flags & Properties
var p = os.path.new(getprop("/sim/fg-home") ~ "/Export/data.txt");
# Booleans
p.exists(); # 1 if physical file exists
p.canRead(); # 1 if read access complies with security limits
p.canWrite(); # 1 if write access complies with security limits
p.isFile(); # 1 if it is a file
p.isDir(); # 1 if it is a directory
p.isAbsolute(); # 1 if it is an absolute path
#
Установить nasal-library-file-system в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл nasal-library-file-system?
Explains the input/output (IO) file handling, property serialization, and directory-path manipulation methods in Nasal, combining raw stream operations ('io') with high-level path parsing wrappers ('os.path').
Как установить скилл nasal-library-file-system?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nasal-library-file-system запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic