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

rndf

v1.0.1

Published

A JS framework that makes the front-end read and download files simpler.

Downloads

3

Readme

简介

RNDF 是 Read and Download Files 的缩写,是一个 web 前端 JS 框架。通过这个框架,能让 web 前端数据与用户本地文件之间的交互更轻松。

只需调用一个方法即可让用户选择本地文件并读取文件的数据,或生成文件让用户保存到本地。

示例

Other languages: pending translation

使用方法

安装

下载 RNDF

可以通过多种方法下载 RNDF:

在网页中引入 RNDF

RNDF 是一个 JavaScript 文件,您可以使用 HTML 的 <script> 标签引入它:

<script src="rndf.min.js"></script>

引入后你就可以开始编写自己的脚本了。

导入文件并读取数据

rndf.readTextFile(elementId, callback(result)[, fileTypes, encoding])

|参数 |类型 |描述 | |-- |-- |-- | |elementId |String |被点击的元素 ID。 | |callback(result) |Function |成功读取文件的回调函数,包含一个存有文件内容的参数。 | |fileTypes(可选)|String |MIME 类型或文件扩展名,多个 MIME 类型和扩展名之间用逗号分隔。填入该参数后浏览器会默认限制用户可选的文件类型。若该参数为 'application/json' 或 '.json',回调函数中的文件内容会自动转换为 JavaScript 对象或数组。| |encoding(可选) |String |编码类型,默认为“utf-8”。 |

将数据导出到文件

导出纯文本文件

rndf.downloadText(elementId, fileName, textString)

|参数 |类型 |描述 | |-- |-- |-- | |elementId |String |被点击的元素 ID。 | |fileName |String |导出文件的文件名。| |textString |String |导出文件的内容。 |

导出 JSON 文件

rndf.downloadJSON(elementId, fileName, JSON_data)

|参数 |类型 |描述 | |-- |-- |-- | |elementId|String |被点击的元素 ID。 | |fileName |String |导出文件的文件名。 | |JSON_data|Object / Array|导出的 JavaScript 对象或数组。|

兼容性

支持的浏览器

|IE |Edge |Chrome |Firefox|Opera|Safari | |-- |-- |-- |-- |-- |-- | |不支持 |79 |49 |44 |36 |11 |

表格中的数字表示支持本框架的浏览器的最低版本。RNDF 不支持 IE 浏览器和 Edge 18 及以下版本的浏览器。

不同版本的 RNDF 兼容性

RNDF 使用语义版本号来管理代码。语义版本号分为 X.Y.Z 三位,分别代表主版本号、次版本号和补丁版本号。

在主版本号和次版本号 X.Y 相同的情况下,更高的补丁版本号 Z 具有向下兼容的问题修正或性能优化;

在主版本号 X 相同的情况下,更高的次版本号 Y 具有向下兼容的功能性新增;

主版本号 X 不同的 API 不向下兼容。

参与贡献

本项目欢迎所有类型的贡献。包括翻译文档、提交错误报告和功能建议等

许可证

本项目采用 Mozilla Public License Version 2.0 进行许可。