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

kun-ling-image

v1.0.61

Published

kun ling image tool

Downloads

72

Readme

坤灵图床-文件助手

功能简介:实现图片的统一管理(水印/压缩/空间管理/上传限流等),支持第三方站点(前端)或服务调用坤灵图床服务,提供上传、查询、删除图片的接口(api)功能.

适用范围:适合所有使用npm工具包的前端js框架,包含但不限于vue.

坤灵图床:点击前往

接口调试工具:点击前往

1、环境依赖(不低于)

node v18.19.1+
npm 10.2.4

2、目录结构描述

kun-ling-image
├─config.json               // 配置
├─index.js                  // 实现函数
├─package.json              // 包说明文件
└README.md                  // help

3、接口功能内容

1)上传图片 info 2)查询图片 upload 3)删除图片 delete

4、部署步骤

4.1 安装npm包

npm install kun-ling-image

4.2 调用需要使用的token参数(由坤灵图床管理员提供)

| token类型 | token参数| | ------------ | ------------ | | 静态(static) | token| | 动态(dynamic) | key,appKey,saltValue,rules|

4.3 具体页面调用(以vue为示例)

1)引入
import { dynamicTokenConfigs,staticTokenConfigs,ImageTool } from "kun-ling-image";
2)调用方法(vue)
methods:{
  async execImage(type,uptype){ // type操作类型(info/delete/upload)
        let imageUrl = 'http://www.image-bed.com/data/upload/api/first-item/20240508194435_818.webp'; // 非必填,当查询、删除图片(type为info/delete)时必填
        let imageFile = '图片二进制文件内容';// 非必填,当上传图片(type为upload)时必填
        let imageExtend = '{"user_id":'+userInfo.uid+'}';// 非必填,当上传图片(type为upload)时选填
        let configs = new staticTokenConfigs();
        if(uptype == 'converse_message'){
             configs.tokenType = 'static'; // static/dynamic"
             configs.token = '817290f3c83acd883186628ad4e4fecc';// 必填
        }else if(uptype == 'avatar'){
             configs = new dynamicTokenConfigs();
             configs.tokenType = 'dynamic'; // static/dynamic
             // configs.time = 1716000517; // 选填(时间戳,单位:秒)
             configs.key = 'EXBgmKTb'; // 必填
             configs.appKey = 'open-doc';// 必填
             configs.saltValue = '1234';// 必填
             configs.rules = 'md5';// 必填
        }
        // configs.siteUrl = 'http://www.image-bed.com'; // 非必填,可为空使用默认
        let kunLingImage = new ImageTool(configs,'development');// development/production
        if(type=='info'){
            await kunLingImage.info(imageUrl).then(data=>{
                 // 实现获取图片信息后续业务逻辑
            });
        }
        if(type=='delete'){
            await kunLingImage.delete(imageUrl).then(data=>{
                 // 实现获取图片信息后续业务逻辑
            });
        }
        if(type=='upload'){
            await kunLingImage.upload(imageFile,imageExtend).then(data=>{
                 // 实现获取图片信息后续业务逻辑
            });
        }
    }
}