code: function cut(buffer, size) {
    var chunks = [];
    var cursor = 0;
    do {
      var chunkSize = Math.min(size, buffer.length - cursor);
      chunks.push(buffer.slice(cursor, cursor + chunkSize));
      cursor += chunkSize;
    } while(cursor < buffer.length);
    return chunks;
  }
docs: Cut `buffer` into chunks not larger than `size`