fromFilePath static method

Future<ImmutableBuffer> fromFilePath(
  1. String path
)

Create a buffer from the file with path.

Throws an Exception if the asset does not exist.

Implementation

static Future<ImmutableBuffer> fromFilePath(String path) {
  final ImmutableBuffer instance = ImmutableBuffer._(0);
  return _futurize((_Callback<int> callback) {
    return instance._initFromFile(path, callback);
  }).then((int length) {
    if (length == -1) {
      throw Exception('Could not load file at $path.');
    }
    return instance.._length = length;
  });
}