platform/packages/file_service
2024-05-22 00:26:09 +08:00
..
example Updated file_service 2021-06-26 20:06:30 +08:00
lib Updated file_service 2021-06-26 20:06:30 +08:00
test Updated file_service 2021-06-26 20:06:30 +08:00
.gitignore Add 'packages/file_service/' from commit '8eeae3c286c20b6c8ca89a11be8a25c1ade16689' 2020-02-15 18:28:36 -05:00
analysis_options.yaml Updated linter 2022-01-04 20:03:52 +08:00
AUTHORS.md Published proxy and file_service 2021-06-10 16:47:05 +08:00
CHANGELOG.md Updated repository links 2023-12-25 11:45:10 +08:00
LICENSE Updated linter 2022-01-04 20:03:52 +08:00
melos_angel3_file_service.iml Added melos 2022-03-19 09:37:28 +08:00
pubspec.yaml Updated lints 2024-05-22 00:26:09 +08:00
README.md Updated repository links 2023-12-25 11:45:10 +08:00

File Service for Angel3

Pub Version (including pre-releases) Null Safety Gitter License

Angel service that persists data to a file on disk, stored as a JSON list. It uses a simple mutex to prevent race conditions, and caches contents in memory until changes are made.

The file will be created on read/write, if it does not already exist.

This package is useful in development, as it prevents you from having to install an external database to run your server.

When running a multi-threaded server, there is no guarantee that file operations will be mutually excluded. Thus, try to only use this one a single-threaded server if possible, or one with very low load.

While not necessarily slow, this package makes no promises about performance.

Usage

configureServer(Angel app) async {
  // Just like a normal service
  app.use(
    '/api/todos',
    JsonFileService(
      const LocalFileSystem().file('todos_db.json')
    ),
  );
}