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

node-ueditor-qiniu

v0.3.0

Published

在node-ueditor插件上扩展,将存储文件放到七牛上.

Downloads

13

Readme

node-ueditor-qiniu

node+ueditor+qiniu

#####支持

  1. 图片上传
  2. 文件上传
  3. 视频上传
  4. 涂鸦上传只能保存到七牛

根据node-ueditor插件扩展,将存储文件存放到七牛上.

example

var nuq = require("node-ueditor-qiniu");
nuq.conf.ACCESS_KEY="xxx";    //七牛开发者ACCESS_KEY
nuq.conf.SECRET_KEY="xxxx";  //七牛开发者SECRET_KEY
nuq.conf.urlhost="xxxx";     //七牛访问的域名
nuq.conf.bucket="xxxx";      //七牛对象储存
nuq.conf.savelocal=true;     //保存七牛和本地 默认只保存到七牛:false
nuq.conf.imageps="watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==/dissolve/88/gravity/SouthEast/dx/10/dy/10";

app.use(bodyParser.urlencoded({
   extended: true
}));

app.use("/ueditor/ue", nuq.ueditor(path.join(__dirname, 'public'), function(req, res, next) {

    // ueditor 客户发起上传请求
    if(req.query.action.indexOf('upload')===0){
        var dir_url = './upload/';        //本地保存路径
        res.ue_up(dir_url);
    }
    //  客户端发起列表请求
    else if (req.query.action.indexOf('list')===0){
        res.ue_list(req.query.action)
    }
    // 客户端发起其它请求
    else {
        res.setHeader('Content-Type', 'application/json');
        // 这里填写 ueditor.config.json 这个文件的路径
        res.redirect('/ueditor/config.json')
    }}));
完整代码
var express = require('express');
var path = require('path');
var bodyParser = require('body-parser');

// var nuq = require("node-ueditor-qiniu");
var nuq = require("node-ueditor-qiniu");
nuq.conf.ACCESS_KEY="xxx";
nuq.conf.SECRET_KEY="xxxx";
nuq.conf.urlhost="xxxx";  //七牛访问的域名
nuq.conf.bucket="xxxx";   
nuq.conf.savelocal=true;     //保存七牛和本地 默认只保存到七牛:false
nuq.conf.imageps="watermark/1/image/aHR0cDovL2RldmVsb3Blci5xaW5pdS5jb20vcmVzb3VyY2UvbG9nby0yLmpwZw==/dissolve/88/gravity/SouthEast/dx/10/dy/10";

var app = express();
 
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(bodyParser.urlencoded({
    extended: true
}));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(express.static(path.join(__dirname, 'public')));

//ueditor访问的地址
app.use("/ueditor/ue", nuq.ueditor(path.join(__dirname, 'public'), function(req, res, next) {

    // ueditor 客户发起上传请求

    if(req.query.action.indexOf('upload')===0){
        var dir_url = './upload/';        //本地保存路径
        res.ue_up(dir_url);
    }
    //  客户端发起获取列表请求
    else if (req.query.action.indexOf('list')===0){
        res.ue_list(req.query.action) // 客户端会列出所有文件
    }
    // 客户端发起其它请求
    else {

        res.setHeader('Content-Type', 'application/json');
        // 这里填写 ueditor.config.json 这个文件的路径
        res.redirect('/ueditor/config.json')
    }}));

app.get('/ueditor', function(req,res){
    res.render("ueditor");
});

var server = app.listen(3000, function () {
    var host = server.address().address;
    var port = server.address().port;

    console.log('Example app listening at http://%s:%s', host, port);
});

升级日志

v0.3.0 涂鸦上传

支持涂鸦上传只支持七牛

v0.2.0 添加图片处理,详情参照

    conf.imageps:string  //图片处理 不处理传空

v0.1.0 添加文件保存到本地

    conf.savelocal:boolean  //是否保存到本地 默认保存到七牛(false)