Henglos IO
Built-in packages

Filesystem

The board's own files — Read one (whole, or a slice at a time), Write or add to one, Copy, Move, Delete, check a path (Info) and List a folder.

The board's own files — Read one (whole, or a slice at a time), Write or add to one, Copy, Move, Delete, check a path (Info) and List a folder. What a Request saved, data to keep between runs, a log.

@henglosio/component-filesystemv1.0.0platform ^1.0.0
NodeKindWhat it does
ReadActionA file's text — all of it when it fits a value (384 bytes), else a slice: Offset and Length pick which, end says whether it's the last.
WriteActionPuts Content in a file — over what was there, or added at its end (Mode).
CopyActionA file to another path — its folders made, over what was there.
MoveActionRenames a file or folder, or moves it elsewhere (the destination's folders are made).
DeleteActionRemoves a file, or a folder — an empty one, or everything in it with Recursive.
InfoActionBranches on whether a path is there — Exists or Missing — with whether it's a folder and its size.
ListActionWhat's in a folder — each entry's name, size and whether it's a folder, sorted by name, as many as fit a value (count says how many there are).

Actions

Read

A file's text — all of it when it fits a value (384 bytes), else a slice: Offset and Length pick which, end says whether it's the last. Fallback when it isn't there or is a folder.

Settings

SettingTypeDefaultWhat it's for
FileText—Required. The file's path — /data/log.txt; bind a Request's file to read its answer.
OffsetNumber (from 0)0Advanced. Where to start, in bytes — 0 is the beginning. The next slice starts at Offset + read.
LengthNumber (from 0)0Advanced. How many bytes to read — 0 (or more than fits) reads as much as fits a value, 384.

Publishes

OutputTypeWhat it is
contentstrThe text read — a character cut at the slice's end is left for the next one.
sizeintThe whole file's size, in bytes.
readintHow many bytes this read took — the next Offset is Offset + read.
endboolWhether this slice reached the end of the file.
errorstrWhy it's Fallback — no_file, is_folder, denied, no_path, failed: …; empty otherwise.

Write

Puts Content in a file — over what was there, or added at its end (Mode). Its folders are made. Fallback for a path the board relies on.

Settings

SettingTypeDefaultWhat it's for
FileText—Required. The file to write — /data/log.txt; its folders are made.
ContentText—What to write — text, or bind an output (a Code binding can build it).
ModeOne of: Overwrite, AppendOverwriteOverwrite replaces what the file had; Append adds at its end (a log).

Publishes

OutputTypeWhat it is
filestrThe file's path.
sizeintThe file's size after writing, in bytes.
errorstrWhy it's Fallback — no_file, is_folder, denied, no_path, failed: …; empty otherwise.

Copy

A file to another path — its folders made, over what was there. Keeps a Request's temporary answer for good. Fallback when the source isn't a file.

Settings

SettingTypeDefaultWhat it's for
FromText—Required. The file to copy — bind a Request's file, or a path.
ToText—Required. Where it goes — its folders are made.

Publishes

OutputTypeWhat it is
filestrThe copy's path.
sizeintThe copy's size, in bytes.
errorstrWhy it's Fallback — no_file, is_folder, denied, no_path, failed: …; empty otherwise.

Move

Renames a file or folder, or moves it elsewhere (the destination's folders are made). Fallback when there's nothing to move or something's already at To.

Settings

SettingTypeDefaultWhat it's for
FromText—Required. The file or folder to move.
ToText—Required. Its new path — nothing may be there yet; its folders are made.

Publishes

OutputTypeWhat it is
filestrThe new path.
errorstrWhy it's Fallback — no_file, is_folder, denied, no_path, failed: …; empty otherwise.

Delete

Removes a file, or a folder — an empty one, or everything in it with Recursive. Fallback when nothing's there or the folder isn't empty.

Settings

SettingTypeDefaultWhat it's for
PathText—Required. The file or folder to remove.
RecursiveOn / offOffAdvanced. A folder goes with everything in it — off, only an empty one.

Publishes

OutputTypeWhat it is
errorstrWhy it's Fallback — no_file, is_folder, denied, no_path, failed: …; empty otherwise.

Info

Branches on whether a path is there — Exists or Missing — with whether it's a folder and its size.

Ends on Exists, Missing — or Fallback when it can't run.

Settings

SettingTypeDefaultWhat it's for
PathText—Required. The file or folder to check.

Publishes

OutputTypeWhat it is
existsboolWhether something's there.
folderboolWhether it's a folder.
sizeintA file's size, in bytes — 0 for a folder or nothing.

List

What's in a folder — each entry's name, size and whether it's a folder, sorted by name, as many as fit a value (count says how many there are).

Settings

SettingTypeDefaultWhat it's for
FolderText/The folder to list — / is the board's root.

Publishes

OutputTypeWhat it is
entrieslist of { name: str, size: int, folder: bool }The entries, sorted by name — bind it to a List variable.
countintHow many entries the folder has — more than entries when they don't all fit.
errorstrWhy it's Fallback — no_folder, denied, failed: …; empty otherwise.

On this page