encode method

List<int> encode (
  1. Archive archive,
  2. {int level: Deflate.BEST_SPEED,
  3. OutputStreamBase output}
)

Implementation

List<int> encode(Archive archive,
    {int level = Deflate.BEST_SPEED, OutputStreamBase output}) {
  output ??= OutputStream();

  startEncode(output, level: level);
  for (final file in archive.files) {
    addFile(file);
  }
  endEncode(comment: archive.comment);
  if (output is OutputStream) {
    return output.getBytes();
  }

  return null;
}