Commit 60e7a86d authored by Romain Casati's avatar Romain Casati
Browse files

Allow downloading streams.

parent 5ac5b7d2
......@@ -68,11 +68,18 @@ def display(obj):
'content': format_repr(obj)})
def download(filename):
def download(filename, fd=None):
Download a file from the local filesystem via a browser dialog.
Download a file from the local filesystem or a stream
via a browser dialog.
The stream is closed by this function.
return get_file(filename)
if fd is None:
fd = open(filename, 'rb')
_, filename = os.path.split(filename), filename)
def put_file(filepath, content):
......@@ -122,9 +129,7 @@ def get_file(filepath):
Download a file from the (emulated) local filesystem.
_, filename = os.path.split(filepath)
with open(filepath, 'rb') as f:, filename)
return download(filepath)
def get_user_module_file(filename):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment