Skip to content

Instantly share code, notes, and snippets.

@dealproc
dealproc / downloader.js
Created June 23, 2015 05:32
Downloader for binary files.
// Would be best to store this in ~/Scripts/durandal/plugins for convenience.
// This is so that when you must download a file from the web, via WebAPI with an OAuth2 token, you can validate yourself to the Api.
// This has been tested with small-ish files, but has not been tested with larger files, like installers. Please offer contributions
// back for those items.
define(["durandal/system", "durandal/app"], function (system, app) {
var defaults = {
url: "", // to be provided by end user.
method: "GET",
mimeType: "application/octet-stream",
filename: "download.bin",