def append_all(file, content, binary=False, encoding=None, errors=None):
    """Append the content to a file.

    :param file: path to file or file descriptor
    :type file: :term:`path-like object` or int
    :param content: file content
    :type content: bytes or str
    :param bool binary: if ``True`` the content must be ``bytes`` else ``str``
    :param str encoding: name of the encoding (ignored if ``binary=True``)
    :param str errors: error handler (ignored if ``binary=True``)
    :return: number of bytes or characters written
    :rtype: int
    :raises OSError: on I/O failure

    .. versionchanged:: 0.6.0
       Add parameter ``errors``
    """
    mode, encoding, errors = ('ab', None, None) if binary else ('at',
        encoding, errors)
    with open(file, mode=mode, encoding=encoding, errors=errors) as fh:
        return fh.write(content)
