write method

void write(
  1. String sha256,
  2. List<int> bytes
)

Keeps bytes, whose SHA-256 the caller has checked is sha256.

Another process writing the same file at the same moment is not an error. Throws ArgumentError unless sha256 is 64 lowercase hex digits.

Implementation

void write(String sha256, List<int> bytes) {
  final file = fileFor(sha256);
  try {
    writeBytesAtomic(file, bytes);
  } on FileSystemException {
    if (_holds(file, bytes.length, sha256)) return;
    rethrow;
  }
}