TomLocalFileSystem class
A local folder as a TomFileSystem.
Writes go to a sibling temporary file, flushed and renamed over the
target. A link is listed with where it leads and is not expanded when it
leaves the root or loops back into its own ancestors. A delete goes to
Finder's Trash, the freedesktop.org trash (through gio or trash-put,
else written directly), or the Windows Recycle Bin.
- Inheritance
-
- Object
- TomFileSystemBase
- TomLocalFileSystem
Constructors
- TomLocalFileSystem(String root, {bool? watchEachDirectory})
-
watchEachDirectorychooses how watch is recursive: one watch per directory (TomDirectoryWatches) or the platform's own recursive watch. It is true on Linux, whereDirectory.watchis not recursive, and false elsewhere; a test sets it to run the Linux way on any host.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onDidChange
→ Stream<
TomFileChangeEvent> -
Every create, write, rename and delete made through this file system.
no setterinherited
-
onDidSave
→ Stream<
Uri> -
no setterinherited
-
onWillSave
→ Stream<
TomWillSaveEvent> -
no setterinherited
- root → Uri
-
The root directory, as an absolute directory URI (trailing
/).finalinherited - rootPath → String
-
The root as a local path.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
absolute(
Uri uri) → Uri -
urimade absolute against root.inherited -
create(
Uri uri, {bool directory = false}) → Future< void> -
Creates an empty file, or with
directorya folder with its parents. A file that already exists is refused.override -
delete(
Uri uri) → Future< void> -
Deletes
urifor good — a folder with everything in it.override -
dispose(
) → Future< void> -
Ends the event streams.
inherited
-
emitChange(
Uri uri, TomFileChangeType type) → void -
Announces a change made through this file system.
inherited
-
exists(
Uri uri) → Future< bool> -
Whether
uriexists.override -
list(
Uri directory) → Future< List< TomFileEntry> > -
The entries of the directory
directory— one level, unsorted.override -
localPathOf(
Uri uri) → String -
urias a local path. -
nameOf(
Uri uri) → String -
The last segment of
uri's path — a file's or folder's own name.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pathOf(
Uri uri) → String? -
uri's path relative to root, or null when it lies outside it.inherited -
read(
Uri uri) → Future< TomFileContent> -
The bytes of
uriand the revision they were read at.override -
readSlice(
Uri uri, {required int maxBytes, required bool fromEnd}) → Future< String?> -
At most
maxBytesofurias text, from its end whenfromEndand from its start otherwise — or null when it does not exist.override -
readText(
Uri uri) → Future< String> -
The text of
uri, decoded as UTF-8.inherited -
rename(
Uri from, Uri to) → Future< void> -
Renames or moves
fromtoto; an existingtois refused.override -
save(
Uri uri) → Future< void> -
Announces that
uriis saved: onWillSave with its text, then onDidSave.inherited -
stat(
Uri uri) → Future< TomFileEntry?> -
uri's entry without reading it, or null when it does not exist.override -
toString(
) → String -
A string representation of this object.
inherited
-
trash(
Uri uri) → Future< bool> -
Deletes
uriby moving it to the platform's trash. Answers false when there is no trash to move it to — the caller then asks before delete: nothing is unlinked without a way back unless somebody said so.override -
uriOf(
String path) → Uri -
The absolute URI of
path, relative to root with/separators.inherited -
watch(
{bool descend(String path)?}) → Stream< TomFileChange> ? -
Changes under root, or null when the platform refuses to watch.
override
-
write(
Uri uri, Uint8List bytes, {TomFileRevision? expected}) → Future< TomFileRevision> -
Writes
bytestouriatomically. Withexpected, refuses with a TomFileConflict when the file is no longer that revision. Answers the revision written.override -
writeText(
Uri uri, String text, {TomFileRevision? expected}) → Future< TomFileRevision> -
write of
textas UTF-8.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited