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 🙏

© 2024 – Pkg Stats / Ryan Hefner

d-resouce

v1.0.3

Published

读取资源管理相关工具

Downloads

5

Readme

🔦 d-resouce

Web-based resource (file, folder) reading tool If this library is helpful to you, I look forward to Star encouragement

简体中文 | English

🎲 Support

A tool built into web applications that facilitates resource (file and folder) reading, making development tasks more efficient and enjoyable.

Key Features:

  • Drag-and-Drop Support: Allows users to drag and drop files and folders directly into the tool, simplifying resource import.
  • Clipboard Support: Supports copying and pasting files from the clipboard.
  • System File and Folder Selection: Enables users to select files or folders directly from their system.
  • Multiple Data Formats: Offers data in two formats - as an array or in a tree structure, catering to different use cases.
  • Read-Only files Mode: Supports read-only access to files.
  • Real-Time Filtering: Provides real-time filtering of files and folders, making it easier to locate specific resources.
  • Rule Validation: Offers real-time validation of file rules; if a file doesn't meet the specified criteria, the operation can be interrupted.
  • Folder Size Tracking: Automatically calculates and displays the total size of all files within each level of a folder.
  • Customizable UI Hooks: Exposes drag-and-drop hover and leave hooks, allowing for UI customization and enhanced user experiences.

🛵 Use

  1. Install the d-resouce dependency
npm install d-resouce
  1. Instantiate the ResHandle
import { ResHandle } from "d-resouce";

const resHandle = new ResHandle(options);
  1. Use helper functions
import { selectResource, selectFileChange, selectFolderChange, filterSize } from "d-resouce"

📒 Document

options

| Field | Type | Description | params | | ---- | ---- | ---- | ---- | | targetDom | HTMLElement | The DOM element associated with the drag-and-drop event | ---- | | dragoverFuc | Function | Hover event for the drag-and-drop object | Event object | | dragleaveFuc | Function | Leave event for the drag-and-drop object | Event object | | beforeReadFuc | Function | Hook function for reading drag-and-drop or paste events before data is read | ---- | | readDataFuc | Function | Hook function for reading drag-and-drop or paste events' results | Data assembled according to the specified mode | | validFuc | Function | All resources read are passed to this function; returning false aborts the read operation | File: size、fullPath、name、type、file | | filterFuc | Function | All resources read are passed to this function; returning false filters out the resource. Note: Filtering out a folder will exclude its contents from the read | Two types: files (parameters as in validFuc) and folders: totalSize, fullPath, name, type, file, children | | mode | String | Value can be 'array' or 'tree' | ---- | | onlyFile | Boolean | Indicates whether to read only files, ignoring folders | ---- | | targetDom | HTMLElement | The DOM element associated with the drag-and-drop event | ---- |

other

| Field | Type | Description | Enter params | Return params | | ---- | ---- | ---- | ---- | ---- | | selectResource | Function | Opens the system resource dialog for selecting resources | 1. Whether it's a directory upload 2. An object with additional attributes for the <input type="file>, for example: { multiple: true } | Native reading results | | selectFolderChange | Function | Handles folder upload and assembles data according to the specified mode | 1. Results from folder upload 2. Mode type ('array' or 'tree'). | Processed results | | selectFileChange | Function | Handles file upload results (without hierarchy) and does not require specifying a mode | 1. Results from file upload 2.Custom formatting method | Processed results (default format according to readDataFuc) | | filterSize | Function | Converts file sizes to specific units (B, KB, MB, GB, TB) | 1.File size | Size as a string with units (e.g., "2.5 MB") |

🙌 交流讨论

wetChat: yl66915 qq email: [email protected]