angularfile-sharing

Serve Downloads from Directory using Angular


I have a list of documents in the same folder I'm serving my Angular application from. I want to make a webpage that shows a list of the documents, and links to download individual ones.

How would I accomplish this?


Solution

  • Although it is generally advisable to serve docs through your own backend,but you could simplify that effort by using some standard angular packages. Below are some of the options:

    1. ngx-doc-viewer - Probably the best library and support a lot of file types. This demo can help you know it better.
    2. ng2-pdf-viewer - When your concerns are limited to pdf, this is a much simpler package to use, but do not have a wide range of customizations.Stackblitz demo
    3. ngx-extended-pdf-viewer - This has a wide range of customizations and can be really cool if your concerns are regarding doc display with a toolbar.Demo
    4. NodeJs + DB - Last but not least, the most customizable and standard approach for complex applications would be building your own backend. The backend server can actually be allocated a folder for docs, and the documents can be uploaded/saved by users/admin in that specific folder.