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

db-file

v1.0.9

Published

使用原生 js 实现的文件上传目前没有加文件类型和大小判断,后期会不定时更新 适用于 vue&react 等前端框架 Files uploaded using native js are not judged by file type and size at present, and will be updated irregularly later

Downloads

21

Readme

file-upload

使用原生 js 实现的文件上传目前没有加文件类型和大小判断,后期会不定时更新 适用于 vue&react 等前端框架 Files uploaded using native js are not judged by file type and size at present, and will be updated irregularly later

Applicable to front-end frameworks such as vue&read

使用方法 usage method

vue 中

import {upload} from 'db-file'

upload 需要传入一个方法来接收上传的 file 对象 Upload needs to pass in a method to receive the uploaded file object

提供 api

upload(callback,type,size)

callback 回调函数 Callback function

type 文件类型 例:['txt','png'] Example of file type: ['txt ',' png ']

size 文件大小 例: 1024或1024*100 传数字 Example of file size: 1024 or 1024 * 100 for digital transmission

downLoad(fileName,data) 下载文件流 Download file stream

fileName 文件名称 Document name

data 文件流

uploadBase(e[0]) 文件转base64 返回一个Promise

调用


调用
upload(back)

function back(e,success,type) {

console.log(e.target.files)//文件流对象&&Filestream Object 1.0.7版本以前
console.log(e)// 1.0.8版本以后
e>>> File stream



type 校验不通过类型 size||type

success 布尔值 false

}

html 中

引入 file.js 文件 调用方法同上