npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ms-files-viewer

v0.0.6

Published

Got it — now we’re talking about a **real production-grade Angular component** that’s intended to work like a file viewer hub (à la `ng2-pdf-viewer`, `ngx-doc-viewer`, etc.).

Readme

Got it — now we’re talking about a real production-grade Angular component that’s intended to work like a file viewer hub (à la ng2-pdf-viewer, ngx-doc-viewer, etc.).

You’ve given me enough technical context — inputs, outputs, interfaces, enums — to build a professional, developer-friendly, and npm-optimized README.md.

Below is a fully rewritten version that reads like a modern open-source Angular library README. It’s ready to drop into your repo and publish to npm as-is.


# 📁 MsFilesViewer

**MsFilesViewer** is a flexible, modern Angular library that provides a unified file viewing experience for multiple document and media types — PDFs, images, videos, audio, Office files, Google Docs, YouTube embeds, and more.

It’s designed to be a **drop-in file viewer** for any Angular 18+ project, supporting both remote and blob sources, with full control over visuals, behaviors, and interaction events.

---

## 🚀 Features

- 🧩 Supports multiple file types:
  - PDF, Images, Audio, Video, YouTube
  - MS Office (via Office Viewer)
  - Google Docs (via Google Viewer)
- 🎨 Fully customizable colors and layout
- 🧠 Smart file-type auto-detection
- 💾 Works with URLs, base64, and Blob objects
- ⚙️ Event-based control (open, close, load)
- 🖼️ Built-in loader and dummy preview image
- 🧱 Built for Angular 18+ (Ivy compatible)

---

## 📦 Installation

```bash
npm install ms-files-viewer

🧩 Usage

1. Import the module

in your standalone component or module import the fileViewer component

import { MsFilesViewerComponent } from 'ms-files-viewer';

imports: [MsFilesViewerComponent],

2. Use the component

<ms-files-viewer
  [filesList]="files"
  [fileViewed]="selectedFile"
  [visible]="viewerVisible"
  (onViewClose)="handleViewerClose($event)">
</ms-files-viewer>

3. Example in Component

import { Component } from '@angular/core';
import { MSFileViewer, FileCategory } from 'ms-files-viewer';

@Component({
  selector: 'app-file-view-demo',
  templateUrl: './file-view-demo.component.html'
})

export class FileViewDemoComponent {
  viewerVisible = true;

//make sure ach file have unique ID
  files: MSFileViewer[] = [
    {
      id: 1,
      title: 'Product Guide',
      url: 'https://example.com/docs/product-guide.pdf',
      fileCategory: FileCategory.Pdf
    },
    {
      id: 2,
      title: 'Demo Video',
      url: 'https://example.com/videos/demo.mp4',
      fileCategory: FileCategory.Video
    }
  ];

  selectedFile = this.files[0];

  handleViewerClose(isClosed: boolean) {
    console.log('Viewer closed:', isClosed);
    this.viewerVisible = false;
  }
}

⚙️ Component API

🧭 Inputs

| Input | Type | Default | Description | Required | ---------------------------- | ---------------- | -------------------------------- | ----------------------------------------- | --------- | loaderGif | string | small-loader.gif | Path to loader image | No | dummyImage | string | dummyImg.png | Placeholder when file not loaded | No | filesList | MSFileViewer[] | [] | Array of file objects to browse | Yes | fileViewed | MSFileViewer | {} | Currently selected file object | No | envUrl | string | '' | Environment base URL for files fetch | No | getFileAsBlobEnfPoint | string | '' | API endpoint to fetch files as blob | No | closeOutSideClick | boolean | false | Close viewer on outside click | No | visible | boolean | false | Show/hide viewer | No | disableKeyboardEvents | boolean | false | Disable arrow keys & ESC handling | No | viewerBgColor | string | '' | Background color of viewer container | No | topBgColor | string | '' | Top bar background color | No | middleBgColor | string | '' | Middle section background color | No | bottomBgColor | string | '' | Bottom bar background color | No | fileViewedBgColor | string | '' | Background for file preview area | No | bottomMenuBorderTopClasses | string | 'border-top' | CSS classes for bottom menu border | No | leftArrowBgColor | string | '' | Background color of left navigation arrow | No | leftArrowColor | string | '#fff' | Icon color for left arrow | No | rightArrowBgColor | string | '' | Background color of right arrow | No | rightArrowColor | string | '#fff' | Icon color for right arrow | No | hideLeftArrow | boolean | false | Hide left navigation arrow | No | hideRightArrow | boolean | false | Hide right navigation arrow | No | hideTop | boolean | false | Hide top section | No | showDropdowMenu | boolean | true | Show top dropdown menu | No | hideBottomMenu | boolean | false | Hide bottom toolbar | No | docViewer | ViewerType | 'office' | Default document viewer type | No | showAutoPlayCheckBox | boolean | 'true' | Show auto play next check box | No


📤 Outputs

| Output | Type | Description | | ------------- | ----------------------- | ------------------------------------------------------------ | | onViewClose | EventEmitter<boolean> | Emits when the viewer is closed manually or programmatically |


🧱 Interface Reference

MSFileViewer

export interface MSFileViewer {
  id: number | string;
  title?: string;
  description?: string;
  url: string;
  type?: string;
  base64?: string;
  blobFile?: Blob;
  videoFileBaseSrc64?: string;
  fileCategory: FileCategory;
  viewer?: ViewerType;
  failedToLoad?: boolean;
  previewLg?: string;
  previewSm?: string;
  user?: MSFileUser;
}

MSFileUser

export interface MSFileUser {
  profile?: string;
  name?: string;
}

FileCategory Enum

export enum FileCategory {
  Video = 'video',
  Audio = 'audio',
  Image = 'image',
  Pdf = 'pdf',
  Google = 'google',
  MSOffice = 'msOffice',
  Youtube = 'youtube',
}

ViewerType

export type ViewerType = 'google' | 'office' | 'mammoth' | 'pdf' | 'url';

🧪 Events Example

<ms-files-viewer
  [filesList]="files"
  [visible]="true"
  (onViewClose)="onViewerClosed($event)">
</ms-files-viewer>
onViewerClosed(closed: boolean) {
  if (closed) {
    console.log('Viewer has been closed.');
  }
}

🧰 Integration Tips

  • Use Angular’s DomSanitizer when dealing with dynamic URLs.
  • To optimize performance, preload common file types or use lazy loading.
  • Combine with ngx-doc-viewer or ng2-pdf-viewer for extended format support.
  • Works well with dynamic file lists fetched from REST APIs.

🧪 Build & Publish

Build

ng build ms-files-viewer

Publish

cd dist/ms-files-viewer
npm publish --access public

🧾 License

IIS © 2025 [IIS]


Built with ❤️ for developers who need a universal file viewer that just works in Angular.