Created
February 6, 2018 18:29
-
-
Save ruslangrimov/d659a58b45d984deb3e2c8df3cf14b99 to your computer and use it in GitHub Desktop.
Shows base64 link to download a file from a jupyter notebook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from IPython.display import HTML | |
import os, base64 | |
def GetLink(fname): | |
with open(fname, 'rb') as f: | |
data = base64.b64encode(f.read()) | |
return HTML('<a href="data:application/binary;base64,{0}" download={1}>{1}</a>'.format(data.decode(), os.path.basename(fname))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Def fucj