/FileDownloader

A file downloader react component

Primary LanguageTypeScript

Setup Instructions

screenshot

To set up the project locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/gmadar/FileDownloader.git
    cd your-repo-name
  2. Use node 18.x: If you have NVM installed, run:

    nvm install

    to install the correct version of node.

  3. Install dependencies: Install project dependencies by running:

    npm install
  4. Run the development server: Start the development server to see your changes live:

    npm run dev
  5. Build the project: To create a production build, run:

    npm run build
  6. Run Storybook: To start Storybook and view the components in different scenarios

    npm run storybook
  7. Run tests: To run the tests, use:

    npm run test
  8. Preview the production build: To preview the production build locally, run:

    npm run preview

File downloader component

Description

This component allows you to download a file or a list of files from a URL.

the files are supplied in a json format as a list of objects with the following structure:

[
  {
    "name": "smss.exe",
    "device": "Mario",
    "path": "\\Device\\HarddiskVolume2\\Windows\\System32\\smss.exe",
    "status": "scheduled"
  },
  {
    "name": "netsh.exe",
    "device": "Luigi",
    "path": "\\Device\\HarddiskVolume2\\Windows\\System32\\netsh.exe",
    "status": "available"
  },
  {
    "name": "uxtheme.dll",
    "device": "Peach",
    "path": "\\Device\\HarddiskVolume1\\Windows\\System32\\uxtheme.dll",
    "status": "available"
  },
  {
    "name": "aries.sys",
    "device": "Daisy",
    "path": "\\Device\\HarddiskVolume1\\Windows\\System32\\aries.sys",
    "status": "scheduled"
  },
  {
    "name": "cryptbase.dll",
    "device": "Yoshi",
    "path": "\\Device\\HarddiskVolume1\\Windows\\System32\\cryptbase.dll",
    "status": "scheduled"
  },
  {
    "name": "7za.exe",
    "device": "Toad",
    "path": "\\Device\\HarddiskVolume1\\temp\\7za.exe",
    "status": "scheduled"
  }
]

Usage

To use this component, you need to provide json as an input prop to the component.

<FileDownloader files={files} />