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

basic-file-preview

v1.0.6

Published

这是一个基于 vue3、element-plus 封装的文件预览组件,目前仅支持预览以(pdf、docx、xlsx、pptx、txt、json、md)格式结尾的文件以及常规格式的图片,并提供水印功能

Readme

Basic File Preview

这是一个基于 vue3、element-plus 封装的文件预览组件,目前仅支持预览以(pdf、docx、xlsx、pptx、txt、json、md)格式结尾的文件以及常规格式的图片,并提供水印功能(水印可根据业务需求自行选择使用)。

安装

npm i basic-file-preview
# or
pnpm i basic-file-preview

在使用 pnpm 安装 basic-file-preview 时,pnpm 会检测到 basic-file-preview 的依赖(@vue-office/docx, @vue-office/excel, @vue-office/pptx, vue-demi)中包含可执行的脚本,出于安全考虑,默认阻止了这些脚本的执行,会出现以下警告

Ignored build scripts: @parcel/watcher, @vue-office/docx, @vue-office/excel, @vue-office/pptx, esbuild, vue-demi. Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.

建议运行 pnpm approve-builds 手动确认这些依赖包的脚本可以被信任并允许执行

用法

示例一:api调用(推荐)

<template>
  <div>
    <button @click="handlePreviewPdf">打开pdf</button>
  </div>
</template>

<script setup lang="ts">
import { preview } from 'basic-file-preview'
const handlePreviewPdf = () => {
  preview({
    name: '这是一个pdf.pdf',
    url: '/example/MySQL-基础篇.pdf',
    watermark: 'kunkun' // (可选)或数组形式,例如:['kunkun', '2026-04-04'],
  })
}
</script>

<style scoped></style>

示例二:组件

<template>
  <div>
    <button @click="handlePreviewPdf">打开pdf</button>
    <FilePreview
      v-model:visible="visible"
      name=" 这是一个pdf.pdf"
      url="/example/MySQL-基础篇.pdf"
      :watermark="watermark" 
    />
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { FilePreview } from 'basic-file-preview'
const visible = ref(false)
const watermark = ref('kunkun') 

const handlePreviewPdf = () => {
  visible.value = true
}
</script>

<style scoped></style>