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

fib-storage

v0.0.6

Published

reademe

Downloads

6

Readme

fib-storage

支持 文件、图片的存储、上传、过滤器显示

Install

$ npm install fib-storage

Usage

  • 实例化

    • conn数据库对象方式

      const FibStorage = require("fib-storage");
      const Db = require("db");
      const conn = Db.open("sqlie:./test.db");
      const fibStorage = new FibStorage(conn);
    • pool对象方式

      const FibStorage = require("fib-storage");
      const Pool = require("fib-pool");
      const Db = require("db");
      
      const fibStorage = new FibStorage(Pool(function() {
          return Db.open("sqlite:./test.db")
      }));
  • 选项参数

    • imgMaxSize: Number, 图片最大上传尺寸 单位byte 默认10mb

Api

fibStorage.fileProc(req); //图片上传、下载(根据请求方式区分,POST为上传,GET为下载)

fibStorage.setup(); //初始化表

fibStorage.put(v, type, extend); //写入数据,返回文件的hash值

fibStorage.get(k); //获取文件

fibStorage.getInfo(k); //只获取文件信息

fibStorage.getValue(k); //只获取文件流数据

fibStorage.remove(k); //删除某行

url2storage

根据url过滤图片

  • 规则

    /hash value.filter.exten

    eg. /4adfd9f2c8e6a62efd36a4f2aceb3f57.g50.jpg

  • 支持列表(陆续更新)

    1. 原图(quality默认70)

      /${hash}.jpg
    2. 拼图 (多个hash以 , 隔开 最多支持4张)

      /${hash},${hash},${hash},${hash}.jpg
    3. q 图片质量(默认70)

      /${hash}.q80.jpg
    4. t 缩略图

      /${hash}.t50x50.jpg
    5. g 高斯模糊

      /${hash}.g50.jpg
    6. o 剪切

      /${hash}.o150x200.jpg
    7. pr 渐进式(扩展名为jpg时默认

      /${hash}.pr.jpg
    8. wb 由下往上画矩形

      /${hash}.wb200.jpg
    9. et 按a*b的范围,等比例缩略图

      /${hash}.et50x50.jpg