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

tuco-cli

v0.1.2

Published

集合型命令行工具

Downloads

4

Readme

tuco

集合型命令行工具

来点 issue❓ / 意见 💭 / 好点子 🚀 ,或者 star⭐ ~

目前功能

  • 图片压缩 & 改尺寸大小 & 换格式后缀
  • 翻译 启动浏览器(百度翻译)

安装

  1. Node 环境

  2. 安装 tuco-cli

npm install -g tuco-cli
  1. 检查 tuco-cli 版本
tuco -v

或者

tuco --version

命令

tuco 作为仓库名,不用于命令(除了版本信息的tuco -vtuco --version)。为了缩减功能命令长度,取tight tight tight(tuco 台词)中的ti作为命令前缀。

  • ti-tp - 压缩图片命令
  • ti-tl - 翻译命令

功能和使用方法

1. tinyPNG 图片压缩 & 转格式 & 转尺寸

图片压缩,图片大小调整,图片转格式(转格式的同时也会压缩)。

对图片的操作都会生成新文件,在原文件名字基础上以 _tiny 结尾命名,不会改变原文件。

在网站 https://tinypng.com/developers 获取 tinypng API key, 初始化:

ti-tp --key="API KEY"

提示 Done 之后,就可以使用 ti-tp 命令对图片处理了,后续无需再次初始化,多次初始化会覆盖之前设置的 key。(tp 取名自 tinypng)

  • 压缩命令

    命令为 ti-tp,采用该命令对图片压缩,转换格式和尺寸大小。

    ti-tp xxx.png

    会在 xxx.png 同级目录生成 xxx_tiny.png, 为压缩后的图片

  • 指定后缀(转码其他格式)

    目标格式的后缀,直接通过 - 指定,如 -png,-jpg

    xxx.png 转为 webp 格式:

    ti-tp -webp xxx.png

    xxx.jpg 转为 png 格式:

    ti-tp -png xxx.jpg
  • 指定尺寸

    对尺寸大小的处理,有三种方式:

    • scale(缩放)
    • fit(适应指定宽高容器,图片显示完全,容器内可能空余)
    • cover(覆盖指定宽高容器,图片可能被裁剪,容器被填满)

    通过参数 --rs, --rf, --rc 指定。(命名依据: r resize, s scale, f fit, c cover)

    • scale 指定宽度 180,高度缩放

      ti-tp --rs='w180' xxx.jpg

      指定高度 180,宽度缩放

      ti-tp --rs='h180' xxx.jpg
    • fit 指定宽 400,高 180,实际可能宽或者高不足

      ti-tp --rf='400*180' xxx.jpg
    • cover 指定宽 400,高 180,图片裁剪后占满

      ti-tp --rc='400*180' xxx.jpg
  • 改后缀同时指定尺寸大小

    ti-tp -png --rs="h200" dbd.jpeg

    将依据 dbd.jpeg 生成 dbd_tiny.png 文件,按高度 200 缩放

2. 翻译

只接受一个参数,待翻译的文本。根据正则匹配第一字符为字母则英译中,否则中译英。

ti-tl fatal打开百度翻译英译中翻译 fatal

ti-tl 你好打开百度翻译中译英翻译 你好

3. Color conversion 颜色转换

todo..