angel_file_service 1.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 22

file_service

Pub build status

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',
    new JsonFileService(
      const LocalFileSystem().file('todos_db.json')
    ),
  );
}

1.1.2

  • Added tests, because tests.

1.1.1

  • Dart 2 fixes.

1.1.0+2

  • create now uses the underlying store, instead of manually patching

1.1.0+1

  • Analyzer nitpick for pana

1.1.0

  • Updated to framework v1.1.x
  • Use package:file
  • Allow a custom store

example/main.dart

import 'package:angel_file_service/angel_file_service.dart';
import 'package:angel_framework/angel_framework.dart';
import 'package:file/local.dart';

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

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  angel_file_service: ^1.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:angel_file_service/angel_file_service.dart';
  
Version Uploaded Documentation Archive
1.1.2 Jul 12, 2018 Go to the documentation of angel_file_service 1.1.2 Download angel_file_service 1.1.2 archive
1.1.1 Jul 12, 2018 Go to the documentation of angel_file_service 1.1.1 Download angel_file_service 1.1.1 archive
1.1.0+2 Dec 22, 2017 Go to the documentation of angel_file_service 1.1.0+2 Download angel_file_service 1.1.0+2 archive
1.1.0+1 Dec 21, 2017 Go to the documentation of angel_file_service 1.1.0+1 Download angel_file_service 1.1.0+1 archive
1.1.0 Dec 21, 2017 Go to the documentation of angel_file_service 1.1.0 Download angel_file_service 1.1.0 archive
1.0.0 Jun 13, 2017 Go to the documentation of angel_file_service 1.0.0 Download angel_file_service 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
45
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
22
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.0.0.
 
 Because angel_file_service depends on file >=0.1.0 <5.0.2 which requires SDK version <2.0.0-∞, version solving failed.

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.8.0 <3.0.0