Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

file-downloader-action

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

file-downloader-action

This is an Angular Module containing Components/Services using Material

latest
npmnpm
Version
18.0.4
Version published
Maintainers
1
Created
Source

FileDownloader

This library was generated with Angular CLI version 15.2.0.

Usage

  • Import the FileDownloaderModule:

    import { FileDownloaderActionModule } from 'file-downloader-action';
    

    Import the FileDownloaderModule into the module where you intend to use the <app-file-downloader-action> component. For example, in your AppModule:

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { FileDownloaderModule } from 'file-downloader-action';
    
    import { AppComponent } from './app.component';
    
    @NgModule({
      declarations: [
        AppComponent
      ],
      imports: [
        BrowserModule,
        FileDownloaderActionModule
      ],
      providers: [],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    
  • Configure the ApiRequest:

    Define an ApiRequest object to specify the file to download:

    import { ApiRequest } from 'http-request-manager';
    
    apiFileRequest = ApiRequest.adapt({
      server: '', // Base URL of your server. Leave blank if the path is absolute.
      path: ['assets', 'icons.svg'], // The path to the file.
    });
    
  • Use the component in your template:

    <app-file-downloader-action
      [apiRequest]="apiFileRequest"
      [displayErrorMessage]="true"
      (completed)="onCompleted()"
    ></app-file-downloader-action>
    
    • [apiRequest]: The ApiRequest object. Specify server and path (file path and name)
    • [displayErrorMessage]: Display error message only as a toast-message.
    • (completed): An event that emits when the download completes.
  • Handle the completed event (optional):

    onCompleted() {
      console.log('Download completed!');
      // Add any logic you want to execute after the download finishes
    }
    

Complete Example:

import { Component } from '@angular/core';
import { ApiRequest } from 'http-request-manager';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.scss']
})
export class AppComponent {
  apiFileRequest = ApiRequest.adapt({
    server: '',
    path: ['assets', 'icons.svg'],
  });

  onCompleted() {
    console.log('Download completed!');
  }
}
<app-file-downloader-action
  [apiRequest]="apiFileRequest"
  [displayErrorMessage]="true"
  (completed)="onCompleted()"
></app-file-downloader-action>

FAQs

Package last updated on 08 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts