getArchive method

  1. @override
Future<Uint8List> getArchive(
  1. String id,
  2. String path
)
override

Reads the file or directory at path out of the container, as a ustar archive — what GET /containers/{id}/archive returns.

Implementation

@override
Future<Uint8List> getArchive(String id, String path) async {
  calls.add('getArchive:$id:$path');
  final c = _require(id);
  final full = p.posix.normalize(path);
  final raw = c.rawArchives[full];
  if (raw != null) return raw;
  final content = c.files[full];
  if (content == null) {
    throw EngineError(
      method: 'GET',
      path: '/containers/$id/archive',
      statusCode: 404,
      body: 'Could not find the file $path in container $id',
    );
  }
  return singleFileArchive(
    path: p.posix.basename(full),
    content: content,
    mode: 0x1A4, // 644
    uid: 0,
    gid: 0,
  );
}