How do I download file in Fable? Let's say I have a CSV data and I want to save it on my machine.
I tried using ts2fable
with the Download.js
. However, it creates just an interface:
// ts2fable 0.6.1
module rec Download
open Fable.Import
type [<AllowNullLiteral>] IExports =
abstract downloadUrl: title: string * url: string -> unit
abstract downloadBlob: title: string * blob: Browser.Blob -> unit
abstract downloadText: title: string * content: string -> unit
I think there is a way directly import a .js module
let download = Fable.Core.JsInterop.importMember "../src/download.js"
But it doesn't look nice and elegant.