file_storage/ny_file_storage library

File storage for Nylo: named disks over the device's folders, the app bundle, memory, or any driver you write, in the style of Laravel's Storage facade.

await disk('documents').put('reports/q3.pdf', pdfBytes);
final String avatar = await disk().putFile('avatars', photo);
Image(image: DiskImage(avatar));

Classes

AssetDiskDriver
The app bundle, read-only.
Disk
One named place to keep files: a folder on the device, the app bundle, memory, or any DiskDriver.
DiskConfig
How to build a disk: its driver, its folder inside that driver, and its rules.
DiskDriver
The primitive operations a storage backend implements.
DiskEntry
A file or folder found by Disk.list().
DiskImage
Shows an image stored on a disk.
FileStorage
Nylo's file storage: named disks, the way Laravel's Storage facade works.
LocalDiskDriver
Files in a folder on the device.
MemoryDiskDriver
A disk that lives in memory: the driver behind FileStorage.fake(), and what local disks use on the web.
XFile
A CrossFile is a cross-platform, simplified File abstraction.

Enums

DiskEntryType
Whether a DiskEntry is a file or a folder.
DiskRoot
The folders on the device a local disk can live in.

Functions

disk([String? name]) → Disk
The disk named name, or the default disk: disk('documents').put('notes.txt', 'Hello').

Exceptions / Errors

DiskCorruptedPathException
Thrown when a path contains control characters.
DiskException
Base class for every file storage error.
DiskFileNotFoundException
Thrown when a file does not exist.
DiskNotConfiguredException
Thrown by disk('name') when no disk has that name.
DiskPathTraversalException
Thrown when a path climbs above the disk's root with ...
DiskReadOnlyException
Thrown when something writes to a read-only disk, such as assets.