Closed reviewher closed 2 years ago
This would work if the frontend you're using can handle "application/octet-stream"
, but I don't think the Jupyter Notebook does.
As a workaround, you could generate a download link using $$.html
and an <a>
tag with href
set to a dataURL. See an example:
$$.html("<a download href='data:text/plain;charset=utf-8;base64," + new Buffer("Hello World").toString('base64') + "'>Download<a/>");
Is there a MIME type for generating a download from a Buffer or string? To compare with another similar service, RunKit can generate a download button if a command returns a Buffer -- try
Buffer([0,1,2,3,4])
in RK. Ideally, something likewould generate a download link.