{"id":14973418,"url":"https://github.com/alferov/angular-file-saver","last_synced_at":"2025-04-12T23:42:08.748Z","repository":{"id":33120072,"uuid":"36759078","full_name":"alferov/angular-file-saver","owner":"alferov","description":"An AngularJS service that provides cross-browser compatibility of HTML5 saveAs() - http://alferov.github.io/angular-file-saver","archived":false,"fork":false,"pushed_at":"2022-04-22T21:32:47.000Z","size":1990,"stargazers_count":211,"open_issues_count":33,"forks_count":105,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-12T23:41:45.949Z","etag":null,"topics":["angular","angular1","angularjs-service","blob","filesaver"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alferov.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-02T20:12:18.000Z","updated_at":"2025-03-29T12:34:28.000Z","dependencies_parsed_at":"2022-06-27T06:10:16.928Z","dependency_job_id":null,"html_url":"https://github.com/alferov/angular-file-saver","commit_stats":null,"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alferov%2Fangular-file-saver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alferov%2Fangular-file-saver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alferov%2Fangular-file-saver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alferov%2Fangular-file-saver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alferov","download_url":"https://codeload.github.com/alferov/angular-file-saver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647257,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular1","angularjs-service","blob","filesaver"],"created_at":"2024-09-24T13:48:41.489Z","updated_at":"2025-04-12T23:42:08.726Z","avatar_url":"https://github.com/alferov.png","language":"JavaScript","readme":"# Angular File Saver\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][travis-image]][travis-url]\n[![Dependency Status][depstat-image]][depstat-url]\n\n\u003e Angular File Saver is an AngularJS service that leverages\n[FileSaver.js](https://github.com/eligrey/FileSaver.js/) and\n[Blob.js](https://github.com/eligrey/Blob.js/) to implement the HTML5 W3C\nsaveAs() interface in browsers that do not natively support it\n\n## Dependencies\n- [Angular](https://github.com/angular/angular.js)\n- [FileSaver.js](https://github.com/eligrey/FileSaver.js/)\n- [Blob.js](https://github.com/eligrey/Blob.js/)\n\nFile `dist/angular-file-saver.bundle.js` contains all required dependencies and\ngrants access to both `Blob.js` and `FileSaver.js` polyfills via `Blob` and\n`SaveAs` services.\n\n## Installation\n\n```sh\n# Using bower:\n$ bower install angular-file-saver\n\n# Using npm:\n$ npm install angular-file-saver\n```\n\n## Basic usage\n- Include `ngFileSaver` module into your project;\n- Pass both `FileSaver` and `Blob` services as dependencies;\n- Create a [Blob object](https://developer.mozilla.org/en/docs/Web/API/Blob) by\npassing an array with data as the first argument and an object with set of options\nas the second one: `new Blob(['text'], { type: 'text/plain;charset=utf-8' })`;\n- Invoke `FileSaver.saveAs` with the following arguments:\n  - `data` **Blob**: a Blob instance;\n  - `filename` **String**: a custom filename (an extension is optional);\n  - `disableAutoBOM` **Boolean**: (optional) Disable automatically provided Unicode text encoding hints;\n\n[Demo](http://alferov.github.io/angular-file-saver/#demo)\n\n## API\n### `FileSaver`\nA core Angular factory.\n#### `#saveAs(data, filename[, disableAutoBOM])`\nImmediately starts saving a file\n\n#### Parameters\n- **Blob** `data`: a Blob instance;\n- **String** `filename`: a custom filename (an extension is optional);\n- **Boolean** `disableAutoBOM` : (optional) Disable automatically provided Unicode text encoding hints;\n\n### `Blob(blobParts[, options]))`\nAn Angular factory that returns a [Blob instance](https://developer.mozilla.org/en/docs/Web/API/Blob).\n\n### `SaveAs(data, filename[, disableAutoBOM])`\nAn Angular factory that returns a [FileSaver.js polyfill](https://github.com/eligrey/FileSaver.js/#syntax).\n\n## Example\n**JS**\n```js\nfunction ExampleCtrl(FileSaver, Blob) {\n  var vm = this;\n\n  vm.val = {\n    text: 'Hey ho lets go!'\n  };\n\n  vm.download = function(text) {\n    var data = new Blob([text], { type: 'text/plain;charset=utf-8' });\n    FileSaver.saveAs(data, 'text.txt');\n  };\n}\n\nangular\n  .module('fileSaverExample', ['ngFileSaver'])\n  .controller('ExampleCtrl', ['FileSaver', 'Blob', ExampleCtrl]);\n```\n\n**HTML**\n```html\n\u003cdiv class=\"wrapper\" ng-controller=\"ExampleCtrl as vm\"\u003e\n  \u003ctextarea\n    ng-model=\"vm.val.text\"\n    name=\"textarea\" rows=\"5\" cols=\"20\"\u003e\n      Hey ho let's go!\n  \u003c/textarea\u003e\n  \u003ca href=\"\" class=\"btn btn-dark btn-small\" ng-click=\"vm.download(vm.val.text)\"\u003e\n    Download\n  \u003c/a\u003e\n\u003c/div\u003e\n```\n\n## License\nMIT © [Philipp Alferov](https://github.com/alferov)\n\n[npm-url]: https://npmjs.org/package/angular-file-saver\n[npm-image]: https://img.shields.io/npm/v/angular-file-saver.svg?style=flat-square\n\n[travis-url]: https://travis-ci.org/alferov/angular-file-saver\n[travis-image]: https://img.shields.io/travis/alferov/angular-file-saver.svg?style=flat-square\n\n[depstat-url]: https://david-dm.org/alferov/angular-file-saver\n[depstat-image]: https://david-dm.org/alferov/angular-file-saver.svg?style=flat-square\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falferov%2Fangular-file-saver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falferov%2Fangular-file-saver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falferov%2Fangular-file-saver/lists"}