@clemox/ngx-file-saver
v18.0.0
Published
URL or blob download helper
Downloads
242
Maintainers
Readme
ngx-file-saver
This projet is an inspiration of eligrey FileSave.js.
The library is full compatible with Angular, and it's simple to use.
Source code
Source code can be found on my GitHub.
Browsers
I made some test on following browsers. | Browser | Version | | ----------------------- | -------------- | | Firefox | 80 | | Google Chrome | 84 | | Microsoft Edge Chromium | 85 |
Install
npm install @clemox/ngx-file-saver
Usage
- Import module
import { NgxFileSaverModule } from '@clemox/ngx-file-saver';
@NgModule({
imports: [ NgxFileSaverModule ]
})
- Declare service
import { NgxFileSaverModule } from '@clemox/ngx-file-saver';
constructor(
private fileSaver: NgxFileSaverService
) { }
- Download file or blob
this.fileSaver.saveUrl(url, 'Test.docx');
const blob = new Blob(['Test de blob'], { type: 'text/plain' });
this.fileSaver.saveBlob(blob, 'Test.txt');-