def nb_chunk(request, chunk=1024):
    """Calculate the number of chunk of a request size.

    Parameters
    ----------
    content: int
        Request content length.
    chunk: int, optional
        Size of the chunks.

    Return
    -------
    int
        Number of chunks expected in the request.

    Examples
    --------
    >>> nb_chunk(1024)
    1
    >>> nb_chunk(1025)
    2
    >>> nb_chunk(2048)
    2
    >>> nb_chunk(2048, 100)
    21

    Note
    ----
    The VIMS data portal stream the binary content
    does not provide a ``content-length`` value.
    For now we get this value to ``4594223`` (4.4 Mb) which
    correspond to the size of a typical 64x64 IR cube.

    """
    if 'content-length' in request.headers:
        size = int(request.headers['content-length'])
    else:
        size = 4594223
    return size // chunk + 1 if size % chunk != 0 else size // chunk