Output the ipyvolume javascript to a local file.

    :type target: str
    :param bool devmode: if True get index.js from js/dist directory
    :param str version: version number of ipyvolume
    :param str version3js: version number of threejs

def save_ipyvolumejs(
    target="", devmode=False, version=ipyvolume._version.__version_js__, version3js=__version_threejs__
):
    """Output the ipyvolume javascript to a local file.

    :type target: str
    :param bool devmode: if True get index.js from js/dist directory
    :param str version: version number of ipyvolume
    :param str version3js: version number of threejs

    """
    url = "https://unpkg.com/ipyvolume@{version}/dist/index.js".format(version=version)
    pyv_filename = 'ipyvolume_v{version}.js'.format(version=version)
    pyv_filepath = os.path.join(target, pyv_filename)

    devfile = os.path.join(os.path.abspath(ipyvolume.__path__[0]), "..", "js", "dist", "index.js")
    if devmode:
        if not os.path.exists(devfile):
            raise IOError('devmode=True but cannot find : {}'.format(devfile))
        if target and not os.path.exists(target):
            os.makedirs(target)
        shutil.copy(devfile, pyv_filepath)
    else:
        download_to_file(url, pyv_filepath)

    # TODO: currently not in use, think about this if we want to have this external for embedding,
    # see also https://github.com/jovyan/pythreejs/issues/109
    # three_filename = 'three_v{version}.js'.format(version=__version_threejs__)
    # three_filepath = os.path.join(target, three_filename)
    # threejs = os.path.join(os.path.abspath(ipyvolume.__path__[0]), "static", "three.js")
    # shutil.copy(threejs, three_filepath)

    return pyv_filename