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

express-ueditor

v1.0.9

Published

一套 Express 服务端中间件。

Downloads

17

Readme

express-ueditor

一套 Express 服务端中间件。

本身为 UEditor 编写,但是express-ueditor完全可以脱离UEditor使用,比如上传文件、上传图片、上传视频等操作。

  • UEditor类是express-ueditor各功能的统一出入口,
  • 各组件以高阶函数的形式提供,比如config(),upload(actionStr)分别返回一个中间件函数。
  • 支持各种自定义配置
  • 测试驱动

入口程序:UEditor

示例:

const app=express();
const router=express.Router();

const ueditor=new UEditor({
    //...如果不提供,则使用默认参数
});

router.use("/controller",ueditor.config());
router.use("/controller",ueditor.upload('uploadimage'));
router.use("/controller",ueditor.upload('uploadfile'));

app.use(router);

会根据ueditor前端传来的action做出响应

api

config()

生成配置中间件。当ueditor前端传来的action="config"时,会自动根据服务端的配置来返回JSON字符串给前端。

upload(actionStr="uploadfile")

生成上传中间件:根据actionStr的不同,生成不同的中间件用以处理图像上传、文件上传、视频上传、涂鸦上传、和远程抓取上传。

actionStr的取值和百度UEditor前端定义的上传类动作名一致,全小写命名。比如要在某个路由下响应'uploadimage'、uploadvideo,则其配置为:

const router=express.Router();
const ueditor=new UEditor({
    videoMaxSize:5*1014*1024*1024,  
});

router.post("/image",ueditor.upload("uploadimage"));
router.post("/video",ueditor.upload("uploadvideo"));

百度UEditor编辑器前端上传文件时,会向相应后端URL发送请求,在QueryString中带上action=uploadimageaction=uploadfile之类的参数。

注意,如果脱离UEditor使用,前端向服务器发起上传请求时,应手工带上这类的action参数。

todo

  • listimage暂时之搭建了一个框架
  • 更方便的路由配置(默认)
  • 上传到其他服务器七牛、亚马逊