How to download image to desktop with OS.File

前端 未结 1 1791
臣服心动
臣服心动 2020-11-29 13:09

I have an image located on the web. For example: https://www.gravatar.com/avatar/eb9895ade1bd6627e054429d1e18b576?s=24&d=identicon&r=PG&f=1

相关标签:
1条回答
  • 2020-11-29 13:22

    You stole half that from my solution here: https://stackoverflow.com/a/25112976/3791822

    And the other half from @nmaier's solution here: https://stackoverflow.com/a/25148685/3791822

    Very nice ;)

    Haha anyways you are real close. You got the ArrayBuffer but pass it as Uint8Array so:

    var promised = OS.File.writeAtomic(file, new Uint8Array(data));

    I don't know if this is the best way to download it. But it looks almost 100% async. Maybe it is the best way. Real cool man!

    0 讨论(0)
提交回复
热议问题