[
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: eligrey\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules/\n.DS_Store\n.idea/\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [2.0.2] - 2019-05-14\n\n- Catching an exception on Send (HEAD) ([#534])\n\n## [2.0.0] - 2018-10-17\n\n- Removed eval to resolve CSP ([#465])\n\n## [2.0.0-rc.4] - 2018-10-17\n\n- Don’t throw on module.exports\n\n## [2.0.0-rc.3] - 2018-09-27\n\n- Switch export method\n\n## [2.0.0-rc.2] - 2018-09-26\n\n- Added a changelog.md\n- Reverted `a.click()` to use dispatch with a try-catch ([#465], [#382])\n- Made third argument to an object where you have to pass `{ autoBom: true }`\n  - boolean are depricated but still works\n\n## [2.0.0-rc.1] - 2018-09-26\n\n- saveAs don't return anything\n  - The object that dispatched `writestart progress write writeend` are gone\n  - detecting such features was never possible and nobody seems to use it.\n- Removed the demo folder\n- Removed date/version from top of the file\n- Dosen't crash in web workers ([#449])\n- Support saving urls ([#260] with workarounds for cross origin)\n- Uses babel universal module pattern (UMD) to export the package\n- Provides source map now as well.\n- use a[download] before msSaveAs ([#193], [#294])\n- removed dist from .gitignore (npm uses it if it don't find a .npmignore)\n- autoBom is now reversed so you have to tell when you want to use autoBom ([#432])\n- `a.click()` since there are new and depricated event constructors that works differently ([#382])\n- opens up a new popup (tab) directly for the fallback method since the FileReader is async\n- removed the explicitly MSIE [1-9] check\n- Uses new anchor link for each save (might solve multiple download problems)\n\n  [#382]: https://github.com/eligrey/FileSaver.js/issues/382\n  [#449]: https://github.com/eligrey/FileSaver.js/issues/449\n  [#260]: https://github.com/eligrey/FileSaver.js/issues/260\n  [#193]: https://github.com/eligrey/FileSaver.js/issues/193\n  [#294]: https://github.com/eligrey/FileSaver.js/issues/294\n  [#432]: https://github.com/eligrey/FileSaver.js/issues/432\n  [#382]: https://github.com/eligrey/FileSaver.js/issues/382\n  [#465]: https://github.com/eligrey/FileSaver.js/issues/465\n  [#469]: https://github.com/eligrey/FileSaver.js/issues/469\n  [#470]: https://github.com/eligrey/FileSaver.js/issues/470\n  [#491]: https://github.com/eligrey/FileSaver.js/issues/491\n  [#534]: https://github.com/eligrey/FileSaver.js/issues/534\n"
  },
  {
    "path": "LICENSE.md",
    "content": "The MIT License\n\nCopyright © 2016 [Eli Grey][1].\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n  [1]: http://eligrey.com\n"
  },
  {
    "path": "README.md",
    "content": "If you need to save really large files bigger than the blob's size limitation or don't have\nenough RAM, then have a look at the more advanced [StreamSaver.js][7]\nthat can save data directly to the hard drive asynchronously with the power of the new streams API. That will have\nsupport for progress, cancelation and knowing when it's done writing\n\nFileSaver.js\n============\n\nFileSaver.js is the solution to saving files on the client-side, and is perfect for\nweb apps that generates files on the client, However if the file is coming from the\nserver we recommend you to first try to use [Content-Disposition][8] attachment response header as it has more cross-browser compatiblity.\n\nLooking for `canvas.toBlob()` for saving canvases? Check out\n[canvas-toBlob.js][2] for a cross-browser implementation.\n\nSupported Browsers\n------------------\n\n| Browser        | Constructs as | Filenames    | Max Blob Size | Dependencies |\n| -------------- | ------------- | ------------ | ------------- | ------------ |\n| Firefox 20+    | Blob          | Yes          | 800 MiB       | None         |\n| Firefox < 20   | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Chrome         | Blob          | Yes          | [2GB][3]      | None         |\n| Chrome for Android | Blob      | Yes          | [RAM/5][3]    | None         |\n| Edge           | Blob          | Yes          | ?             | None         |\n| IE 10+         | Blob          | Yes          | 600 MiB       | None         |\n| Opera 15+      | Blob          | Yes          | 500 MiB       | None         |\n| Opera < 15     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Safari 6.1+*   | Blob          | No           | ?             | None         |\n| Safari < 6     | data: URI     | No           | n/a           | [Blob.js](https://github.com/eligrey/Blob.js) |\n| Safari 10.1+   | Blob          | Yes          | n/a           | None         |\n\nFeature detection is possible:\n\n```js\ntry {\n    var isFileSaverSupported = !!new Blob;\n} catch (e) {}\n```\n\n### IE < 10\n\nIt is possible to save text files in IE < 10 without Flash-based polyfills.\nSee [ChenWenBrian and koffsyrup's `saveTextAs()`](https://github.com/koffsyrup/FileSaver.js#examples) for more details.\n\n### Safari 6.1+\n\nBlobs may be opened instead of saved sometimes—you may have to direct your Safari users to manually\npress <kbd>⌘</kbd>+<kbd>S</kbd> to save the file after it is opened. Using the `application/octet-stream` MIME type to force downloads [can cause issues in Safari](https://github.com/eligrey/FileSaver.js/issues/12#issuecomment-47247096).\n\n### iOS\n\nsaveAs must be run within a user interaction event such as onTouchDown or onClick; setTimeout will prevent saveAs from triggering. Due to restrictions in iOS saveAs opens in a new window instead of downloading, if you want this fixed please [tell Apple how this WebKit bug is affecting you](https://bugs.webkit.org/show_bug.cgi?id=167341).\n\nSyntax\n------\n### Import `saveAs()` from file-saver\n```js\nimport { saveAs } from 'file-saver';\n```\n\n```js\nFileSaver saveAs(Blob/File/Url, optional DOMString filename, optional Object { autoBom })\n```\n\nPass `{ autoBom: true }` if you want FileSaver.js to automatically provide Unicode text encoding hints (see: [byte order mark](https://en.wikipedia.org/wiki/Byte_order_mark)). Note that this is only done if your blob type has `charset=utf-8` set.\n\nExamples\n--------\n\n### Saving text using `require()`\n```js\nvar FileSaver = require('file-saver');\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(blob, \"hello world.txt\");\n```\n\n### Saving text\n\n```js\nvar blob = new Blob([\"Hello, world!\"], {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(blob, \"hello world.txt\");\n```\n\n### Saving URLs\n\n```js\nFileSaver.saveAs(\"https://httpbin.org/image\", \"image.jpg\");\n```\nUsing URLs within the same origin will just use `a[download]`.\nOtherwise, it will first check if it supports cors header with a synchronous head request.\nIf it does, it will download the data and save using blob URLs.\nIf not, it will try to download it using `a[download]`.\n\nThe standard W3C File API [`Blob`][4] interface is not available in all browsers.\n[Blob.js][5] is a cross-browser `Blob` implementation that solves this.\n\n### Saving a canvas\n```js\nvar canvas = document.getElementById(\"my-canvas\");\ncanvas.toBlob(function(blob) {\n    saveAs(blob, \"pretty image.png\");\n});\n```\n\nNote: The standard HTML5 `canvas.toBlob()` method is not available in all browsers.\n[canvas-toBlob.js][6] is a cross-browser `canvas.toBlob()` that polyfills this.\n\n### Saving File\n\nYou can save a File constructor without specifying a filename. If the\nfile itself already contains a name, there is a hand full of ways to get a file\ninstance (from storage, file input, new constructor, clipboard event).\nIf you still want to change the name, then you can change it in the 2nd argument.\n\n```js\n// Note: Ie and Edge don't support the new File constructor,\n// so it's better to construct blobs and use saveAs(blob, filename)\nvar file = new File([\"Hello, world!\"], \"hello world.txt\", {type: \"text/plain;charset=utf-8\"});\nFileSaver.saveAs(file);\n```\n\n\n\n![Tracking image](https://in.getclicky.com/212712ns.gif)\n\n  [1]: http://eligrey.com/demos/FileSaver.js/\n  [2]: https://github.com/eligrey/canvas-toBlob.js\n  [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=375297#c107\n  [4]: https://developer.mozilla.org/en-US/docs/DOM/Blob\n  [5]: https://github.com/eligrey/Blob.js\n  [6]: https://github.com/eligrey/canvas-toBlob.js\n  [7]: https://github.com/jimmywarting/StreamSaver.js\n  [8]: https://github.com/eligrey/FileSaver.js/wiki/Saving-a-remote-file#using-http-header\n\nInstallation\n------------------\n\n```bash\n# Basic Node.JS installation\nnpm install file-saver --save\nbower install file-saver\n```\n\nAdditionally, TypeScript definitions can be installed via:\n\n```bash\n# Additional typescript definitions\nnpm install @types/file-saver --save-dev\n```\n"
  },
  {
    "path": "bower.json",
    "content": "{\n  \"name\": \"file-saver\",\n  \"main\": \"dist/FileSaver.min.js\",\n  \"version\": \"2.0.0-rc.3\",\n  \"homepage\": \"https://github.com/eligrey/FileSaver.js\",\n  \"authors\": [\n    \"Eli Grey <me@eligrey.com>\"\n  ],\n  \"description\": \"An HTML5 saveAs() FileSaver implementation\",\n  \"keywords\": [\n    \"filesaver\",\n    \"saveas\",\n    \"blob\"\n  ],\n  \"license\": \"MIT\",\n  \"ignore\": [\n      \"*\",\n      \"!dist/*\",\n      \"!LICENSE.md\"\n  ]\n}\n"
  },
  {
    "path": "dist/FileSaver.js",
    "content": "(function (global, factory) {\n  if (typeof define === \"function\" && define.amd) {\n    define([], factory);\n  } else if (typeof exports !== \"undefined\") {\n    factory();\n  } else {\n    var mod = {\n      exports: {}\n    };\n    factory();\n    global.FileSaver = mod.exports;\n  }\n})(this, function () {\n  \"use strict\";\n\n  /*\n  * FileSaver.js\n  * A saveAs() FileSaver implementation.\n  *\n  * By Eli Grey, http://eligrey.com\n  *\n  * License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n  * source  : http://purl.eligrey.com/github/FileSaver.js\n  */\n  // The one and only way of getting global scope in all environments\n  // https://stackoverflow.com/q/3277182/1008999\n  var _global = typeof window === 'object' && window.window === window ? window : typeof self === 'object' && self.self === self ? self : typeof global === 'object' && global.global === global ? global : void 0;\n\n  function bom(blob, opts) {\n    if (typeof opts === 'undefined') opts = {\n      autoBom: false\n    };else if (typeof opts !== 'object') {\n      console.warn('Deprecated: Expected third argument to be a object');\n      opts = {\n        autoBom: !opts\n      };\n    } // prepend BOM for UTF-8 XML and text/* types (including HTML)\n    // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n\n    if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n      return new Blob([String.fromCharCode(0xFEFF), blob], {\n        type: blob.type\n      });\n    }\n\n    return blob;\n  }\n\n  function download(url, name, opts) {\n    var xhr = new XMLHttpRequest();\n    xhr.open('GET', url);\n    xhr.responseType = 'blob';\n\n    xhr.onload = function () {\n      saveAs(xhr.response, name, opts);\n    };\n\n    xhr.onerror = function () {\n      console.error('could not download file');\n    };\n\n    xhr.send();\n  }\n\n  function corsEnabled(url) {\n    var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker\n\n    xhr.open('HEAD', url, false);\n\n    try {\n      xhr.send();\n    } catch (e) {}\n\n    return xhr.status >= 200 && xhr.status <= 299;\n  } // `a.click()` doesn't work for all browsers (#465)\n\n\n  function click(node) {\n    try {\n      node.dispatchEvent(new MouseEvent('click'));\n    } catch (e) {\n      var evt = document.createEvent('MouseEvents');\n      evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n      node.dispatchEvent(evt);\n    }\n  } // Detect WebView inside a native macOS app by ruling out all browsers\n  // We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n  // https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\n\n\n  var isMacOSWebView = /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent);\n  var saveAs = _global.saveAs || ( // probably in some web worker\n  typeof window !== 'object' || window !== _global ? function saveAs() {}\n  /* noop */\n  // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n  : 'download' in HTMLAnchorElement.prototype && !isMacOSWebView ? function saveAs(blob, name, opts) {\n    var URL = _global.URL || _global.webkitURL;\n    var a = document.createElement('a');\n    name = name || blob.name || 'download';\n    a.download = name;\n    a.rel = 'noopener'; // tabnabbing\n    // TODO: detect chrome extensions & packaged apps\n    // a.target = '_blank'\n\n    if (typeof blob === 'string') {\n      // Support regular links\n      a.href = blob;\n\n      if (a.origin !== location.origin) {\n        corsEnabled(a.href) ? download(blob, name, opts) : click(a, a.target = '_blank');\n      } else {\n        click(a);\n      }\n    } else {\n      // Support blobs\n      a.href = URL.createObjectURL(blob);\n      setTimeout(function () {\n        URL.revokeObjectURL(a.href);\n      }, 4E4); // 40s\n\n      setTimeout(function () {\n        click(a);\n      }, 0);\n    }\n  } // Use msSaveOrOpenBlob as a second approach\n  : 'msSaveOrOpenBlob' in navigator ? function saveAs(blob, name, opts) {\n    name = name || blob.name || 'download';\n\n    if (typeof blob === 'string') {\n      if (corsEnabled(blob)) {\n        download(blob, name, opts);\n      } else {\n        var a = document.createElement('a');\n        a.href = blob;\n        a.target = '_blank';\n        setTimeout(function () {\n          click(a);\n        });\n      }\n    } else {\n      navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n    }\n  } // Fallback to using FileReader and a popup\n  : function saveAs(blob, name, opts, popup) {\n    // Open a popup immediately do go around popup blocker\n    // Mostly only available on user interaction and the fileReader is async so...\n    popup = popup || open('', '_blank');\n\n    if (popup) {\n      popup.document.title = popup.document.body.innerText = 'downloading...';\n    }\n\n    if (typeof blob === 'string') return download(blob, name, opts);\n    var force = blob.type === 'application/octet-stream';\n\n    var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari;\n\n    var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n\n    if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== 'undefined') {\n      // Safari doesn't allow downloading of blob URLs\n      var reader = new FileReader();\n\n      reader.onloadend = function () {\n        var url = reader.result;\n        url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n        if (popup) popup.location.href = url;else location = url;\n        popup = null; // reverse-tabnabbing #460\n      };\n\n      reader.readAsDataURL(blob);\n    } else {\n      var URL = _global.URL || _global.webkitURL;\n      var url = URL.createObjectURL(blob);\n      if (popup) popup.location = url;else location.href = url;\n      popup = null; // reverse-tabnabbing #460\n\n      setTimeout(function () {\n        URL.revokeObjectURL(url);\n      }, 4E4); // 40s\n    }\n  });\n  _global.saveAs = saveAs.saveAs = saveAs;\n\n  if (typeof module !== 'undefined') {\n    module.exports = saveAs;\n  }\n});\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"file-saver\",\n  \"version\": \"2.0.5\",\n  \"description\": \"An HTML5 saveAs() FileSaver implementation\",\n  \"main\": \"dist/FileSaver.min.js\",\n  \"files\": [\n    \"dist/FileSaver.js\",\n    \"dist/FileSaver.min.js\",\n    \"dist/FileSaver.min.js.map\",\n    \"src/FileSaver.js\"\n  ],\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 0\",\n    \"build:development\": \"babel -o dist/FileSaver.js --plugins @babel/plugin-transform-modules-umd src/FileSaver.js\",\n    \"build:production\": \"babel -o dist/FileSaver.min.js -s --plugins @babel/plugin-transform-modules-umd --presets minify src/FileSaver.js\",\n    \"build\": \"npm run build:development && npm run build:production\",\n    \"prepublishOnly\": \"npm run build\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/eligrey/FileSaver.js\"\n  },\n  \"keywords\": [\n    \"filesaver\",\n    \"saveas\",\n    \"blob\"\n  ],\n  \"author\": \"Eli Grey <me@eligrey.com>\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/eligrey/FileSaver.js/issues\"\n  },\n  \"homepage\": \"https://github.com/eligrey/FileSaver.js#readme\",\n  \"devDependencies\": {\n    \"@babel/cli\": \"^7.1.0\",\n    \"@babel/core\": \"^7.1.0\",\n    \"@babel/plugin-transform-modules-umd\": \"^7.1.0\",\n    \"babel-preset-minify\": \"^0.4.3\"\n  }\n}\n"
  },
  {
    "path": "src/FileSaver.js",
    "content": "/*\n* FileSaver.js\n* A saveAs() FileSaver implementation.\n*\n* By Eli Grey, http://eligrey.com\n*\n* License : https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md (MIT)\n* source  : http://purl.eligrey.com/github/FileSaver.js\n*/\n\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nvar _global = typeof window === 'object' && window.window === window\n  ? window : typeof self === 'object' && self.self === self\n  ? self : typeof global === 'object' && global.global === global\n  ? global\n  : this\n\nfunction bom (blob, opts) {\n  if (typeof opts === 'undefined') opts = { autoBom: false }\n  else if (typeof opts !== 'object') {\n    console.warn('Deprecated: Expected third argument to be a object')\n    opts = { autoBom: !opts }\n  }\n\n  // prepend BOM for UTF-8 XML and text/* types (including HTML)\n  // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n  if (opts.autoBom && /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n    return new Blob([String.fromCharCode(0xFEFF), blob], { type: blob.type })\n  }\n  return blob\n}\n\nfunction download (url, name, opts) {\n  var xhr = new XMLHttpRequest()\n  xhr.open('GET', url)\n  xhr.responseType = 'blob'\n  xhr.onload = function () {\n    saveAs(xhr.response, name, opts)\n  }\n  xhr.onerror = function () {\n    console.error('could not download file')\n  }\n  xhr.send()\n}\n\nfunction corsEnabled (url) {\n  var xhr = new XMLHttpRequest()\n  // use sync to avoid popup blocker\n  xhr.open('HEAD', url, false)\n  try {\n    xhr.send()\n  } catch (e) {}\n  return xhr.status >= 200 && xhr.status <= 299\n}\n\n// `a.click()` doesn't work for all browsers (#465)\nfunction click (node) {\n  try {\n    node.dispatchEvent(new MouseEvent('click'))\n  } catch (e) {\n    var evt = document.createEvent('MouseEvents')\n    evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80,\n                          20, false, false, false, false, 0, null)\n    node.dispatchEvent(evt)\n  }\n}\n\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nvar isMacOSWebView = _global.navigator && /Macintosh/.test(navigator.userAgent) && /AppleWebKit/.test(navigator.userAgent) && !/Safari/.test(navigator.userAgent)\n\nvar saveAs = _global.saveAs || (\n  // probably in some web worker\n  (typeof window !== 'object' || window !== _global)\n    ? function saveAs () { /* noop */ }\n\n  // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView\n  : ('download' in HTMLAnchorElement.prototype && !isMacOSWebView)\n  ? function saveAs (blob, name, opts) {\n    var URL = _global.URL || _global.webkitURL\n    // Namespace is used to prevent conflict w/ Chrome Poper Blocker extension (Issue #561)\n    var a = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')\n    name = name || blob.name || 'download'\n\n    a.download = name\n    a.rel = 'noopener' // tabnabbing\n\n    // TODO: detect chrome extensions & packaged apps\n    // a.target = '_blank'\n\n    if (typeof blob === 'string') {\n      // Support regular links\n      a.href = blob\n      if (a.origin !== location.origin) {\n        corsEnabled(a.href)\n          ? download(blob, name, opts)\n          : click(a, a.target = '_blank')\n      } else {\n        click(a)\n      }\n    } else {\n      // Support blobs\n      a.href = URL.createObjectURL(blob)\n      setTimeout(function () { URL.revokeObjectURL(a.href) }, 4E4) // 40s\n      setTimeout(function () { click(a) }, 0)\n    }\n  }\n\n  // Use msSaveOrOpenBlob as a second approach\n  : 'msSaveOrOpenBlob' in navigator\n  ? function saveAs (blob, name, opts) {\n    name = name || blob.name || 'download'\n\n    if (typeof blob === 'string') {\n      if (corsEnabled(blob)) {\n        download(blob, name, opts)\n      } else {\n        var a = document.createElement('a')\n        a.href = blob\n        a.target = '_blank'\n        setTimeout(function () { click(a) })\n      }\n    } else {\n      navigator.msSaveOrOpenBlob(bom(blob, opts), name)\n    }\n  }\n\n  // Fallback to using FileReader and a popup\n  : function saveAs (blob, name, opts, popup) {\n    // Open a popup immediately do go around popup blocker\n    // Mostly only available on user interaction and the fileReader is async so...\n    popup = popup || open('', '_blank')\n    if (popup) {\n      popup.document.title =\n      popup.document.body.innerText = 'downloading...'\n    }\n\n    if (typeof blob === 'string') return download(blob, name, opts)\n\n    var force = blob.type === 'application/octet-stream'\n    var isSafari = /constructor/i.test(_global.HTMLElement) || _global.safari\n    var isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent)\n\n    if ((isChromeIOS || (force && isSafari) || isMacOSWebView) && typeof FileReader !== 'undefined') {\n      // Safari doesn't allow downloading of blob URLs\n      var reader = new FileReader()\n      reader.onloadend = function () {\n        var url = reader.result\n        url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, 'data:attachment/file;')\n        if (popup) popup.location.href = url\n        else location = url\n        popup = null // reverse-tabnabbing #460\n      }\n      reader.readAsDataURL(blob)\n    } else {\n      var URL = _global.URL || _global.webkitURL\n      var url = URL.createObjectURL(blob)\n      if (popup) popup.location = url\n      else location.href = url\n      popup = null // reverse-tabnabbing #460\n      setTimeout(function () { URL.revokeObjectURL(url) }, 4E4) // 40s\n    }\n  }\n)\n\n_global.saveAs = saveAs.saveAs = saveAs\n\nif (typeof module !== 'undefined') {\n  module.exports = saveAs;\n}\n"
  }
]