fileReader static method

Conveyor<Free<IOOp, dynamic>, UnmodifiableListView<int>> fileReader(
  1. String path, [
  2. int chunkBytes = 4096
])

Implementation

static Conveyor<Free<IOOp, dynamic>, UnmodifiableListView<int>> fileReader(String path, [int chunkBytes = 4096]) => Source.resource(
    io.openFile(path, true),
    (FileRef file) => Source.eval<Free<IOOp, dynamic>, UnmodifiableListView<int>>(io.readBytes(file, chunkBytes)).repeat().takeWhile((bytes) => bytes.isNotEmpty),
    (FileRef file) => Source.eval_(io.closeFile(file)));