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

ngx-file-peek

v1.0.4

Published

Angular component that renders file content thumbnails from any URL (images, PDF, Word, Excel)

Readme

ngx-file-peek

npm version license

Peek at any file without opening it. An Angular standalone component library that renders real file content as thumbnails from any URL, any storage.

Pass a file URL (S3, MinIO, Azure Blob, Firebase, Google Cloud, or any HTTP link) and ngx-file-peek renders an actual preview of the content. No file opening, no downloads, no iframes.


Supported File Types

| File Type | What You See | |---|---| | Images (.jpg, .png, .gif, .webp, .svg) | The actual image, lazy-loaded | | PDF (.pdf) | First page rendered on canvas via PDF.js | | Word (.doc, .docx) | Document content parsed via mammoth.js | | Excel (.xls, .xlsx) | Spreadsheet table rendered via ExcelJS | | Other | Clean file-type icon with label |


Quick Start

1. Install

npm install ngx-file-peek @angular/cdk pdfjs-dist mammoth exceljs

2. Configure

// app.config.ts
import { provideFilePreview } from 'ngx-file-peek';

export const appConfig: ApplicationConfig = {
  providers: [
    provideFilePreview({
      pdfWorkerUrl: 'https://cdn.jsdelivr.net/npm/pdfjs-dist@5/build/pdf.worker.min.mjs',
      tooltipDelay: 300,
    }),
  ],
};

3. Use

import { FileThumbnailComponent } from 'ngx-file-peek';

@Component({
  standalone: true,
  imports: [FileThumbnailComponent],
  template: `<fp-file-thumbnail [url]="fileUrl" size="md" />`,
})
export class MyComponent {
  fileUrl = 'https://my-storage.com/files/report.pdf';
}

Usage Examples

Grid View -- Thumbnails showing file content

import { FileThumbnailComponent } from 'ngx-file-peek';

@Component({
  standalone: true,
  imports: [FileThumbnailComponent],
  template: `
    <div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;">
      @for (file of files; track file.url) {
        <fp-file-thumbnail [url]="file.url" size="md" />
      }
    </div>
  `,
})
export class FileGridComponent {
  files = [
    { url: 'https://minio.myapp.com/bucket/photo.jpg' },
    { url: 'https://s3.amazonaws.com/docs/report.pdf' },
    { url: 'https://storage.example.com/proposal.docx' },
    { url: 'https://api.example.com/files/data.xlsx?token=abc' },
  ];
}

List View -- Hover to preview

import { FilePreviewTooltipDirective } from 'ngx-file-peek';

@Component({
  standalone: true,
  imports: [FilePreviewTooltipDirective],
  template: `
    @for (file of files; track file.url) {
      <div [filePreviewTooltip]="file.url" style="padding: 8px; cursor: pointer;">
        {{ file.name }}
      </div>
    }
  `,
})
export class FileListComponent {
  files = [
    { name: 'invoice.pdf',   url: 'https://api.myapp.com/files/invoice.pdf' },
    { name: 'contract.docx', url: 'https://api.myapp.com/files/contract.docx' },
    { name: 'sales.xlsx',    url: 'https://api.myapp.com/files/sales.xlsx' },
  ];
}

Hovering a file shows a floating preview with:

  • File name and type badge
  • Full content preview (320px)
  • Pin -- keep the tooltip open
  • Maximize -- open in a full-screen lightbox
  • Download -- save the file
  • Open in new tab -- view in browser

Grid + Tooltip combined

import { FileThumbnailComponent, FilePreviewTooltipDirective } from 'ngx-file-peek';

@Component({
  standalone: true,
  imports: [FileThumbnailComponent, FilePreviewTooltipDirective],
  template: `
    @for (file of files; track file.url) {
      <div [filePreviewTooltip]="file.url">
        <fp-file-thumbnail [url]="file.url" size="sm" />
        <span>{{ file.name }}</span>
      </div>
    }
  `,
})

Works With Any Storage

Just pass the URL:

// Amazon S3
'https://my-bucket.s3.amazonaws.com/docs/report.pdf'

// MinIO
'https://minio.myapp.com/bucket/image.png'

// Azure Blob Storage
'https://myaccount.blob.core.windows.net/container/file.docx'

// Google Cloud Storage
'https://storage.googleapis.com/my-bucket/spreadsheet.xlsx'

// Firebase Storage
'https://firebasestorage.googleapis.com/v0/b/my-app/o/photo.jpg?alt=media'

// Presigned URLs with auth tokens
'https://api.myapp.com/files/doc.pdf?token=eyJhbGciOi...'

File type is detected from the URL extension. Query strings and tokens are stripped before detection.


API Reference

<fp-file-thumbnail>

| Input | Type | Default | Description | |---|---|---|---| | url | string | required | File URL from any storage | | size | 'sm' \| 'md' \| 'lg' | 'md' | Thumbnail size | | tooltip | boolean | false | Show preview tooltip on hover |

Sizes: sm = 80px, md = 120px, lg = 200px

[filePreviewTooltip]

| Input | Type | Description | |---|---|---| | filePreviewTooltip | string | File URL to preview on hover |

The tooltip includes an action bar with pin, maximize, download, and open-in-new-tab buttons. Mouse can move into the tooltip to interact with these buttons.

provideFilePreview(config)

| Option | Type | Default | Description | |---|---|---|---| | pdfWorkerUrl | string | -- | URL to PDF.js worker (required for PDFs) | | tooltipDelay | number | 300 | Delay in ms before tooltip appears | | placeholderTheme | 'minimal' \| 'branded' | 'minimal' | Placeholder style for unknown types |

Exported Types

import { FileType, ThumbnailSize, FilePreviewConfig } from 'ngx-file-peek';

Theming

:root {
  --ngx-fp-border-radius: 8px;
  --ngx-fp-bg: #ffffff;
  --ngx-fp-placeholder-bg: #f5f5f5;
}

/* Dark mode */
.dark {
  --ngx-fp-bg: #1e1e1e;
  --ngx-fp-placeholder-bg: #2d2d2d;
}

Requirements

  • Angular 17+ (standalone components, signal inputs)
  • @angular/cdk -- overlay positioning
  • pdfjs-dist -- PDF rendering
  • mammoth -- Word document parsing
  • exceljs -- Excel spreadsheet parsing

License

MIT -- Valton Gara