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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nomi-oss-upload

v1.0.2

Published

oss upload CLI

Downloads

3

Readme

nomi-oss-upload

基于 ali-oss 上传的脚手架工具。

安装

npm i -g nomi-oss-upload

使用

# 上传
nomi-oss-upload [options]

# 帮助文档
nomi-oss-upload --help

options 参数说明

config

CLI 上传配置文件

默认值:nomi.upload.config.js

使用方式:-c, --config

nomi-oss-upload -c upload.config.js

配置文件参数:

| 参数 | 描述 | 类型 | 默认值 | | -----| ---- | ---- | ---- | | ossApiConfig | 通过接口动态获取配置 | 参考下面的 ossApiConfig 配置 | - | | ossConfig | 固定配置 | 需要符合 ali-oss 配置 | - | | saveDir | 上传文件时保存的oss目录 | string | - | | random | 是否生成随机文件名称 | boolean | - | | debug | 是否开启调试模式 | boolean | - |

ossApiConfig 配置: | 参数 | 描述 | 类型 | 默认值 | | -----| ---- | ---- | ---- | | url | 通过接口动态获取配置 | 单元格 | - | | transferResponse | 固定配置 | 单元格 | - |

配置文件示例:

module.exports = {
    // 从接口动态获取配置
    ossApiConfig: {
      // 动态获取oss配置的接口地址
      url: "https://xxx.xx.xxx",
      // 转化接口响应数据,需要符合 ali-oss 初始化实例的参数字段 https://www.npmjs.com/package/ali-oss#ossoptions
      transferResponse: (data) => {
        const { securityToken: stsToken, accessKeyId, accessKeySecret, region, bucketName: bucket, endpoint, expiration } = data.data
        const res = {
          accessKeyId,
          region,
          bucket,
          accessKeySecret,
          endpoint,
          stsToken,
        }
        if (expiration && typeof expiration === 'string') {
          res.expiration = new Date(expiration).getTime()
        }
        return res
      }
    },
    // 本地固定配置
    ossConfig: {
      region: "",
      bucket: "",
      endpoint: "",
      accessKeyId: "",
      accessKeySecret: "",
      stsToken: ""
    },
    // 上传文件时保存的oss目录
    saveDir: 'nomi',
    // 随机生成文件名称
    random: true,
    // 开启调试模式
    debug: false,
}

⚠️注意:

  • CLI会优先取配置文件定义的字段,如果配置文件没有的情况下,才会取命令行参数字段
  • 优先取 ossApiConfig 配置, 如果没有配置才会取 ossConfig 配置
  • 无论是动态获取的配置还是固定的配置都需要符合 ali-oss 初始化参数

api

用于获取oss上传文件配置接口url,例如:https://example.com/api/oss/aliyun/get-oss-config

使用方式:-a, --api

nomi-oss-upload --api https://example.com/api/oss/aliyun/get-oss-config

url响应结构:

interface Res {
    accessKeyId: string
    bucket: string
    accessKeySecret: string
    endpoint: string
    stsToken: string
    region?: string
    expiration?: number
}

file

待上传本地文件路径或目录路径(相对路径)

使用方式:-f, --file

nomi-oss-upload --file path/to/example.json

saveDir

上传文件时保存的oss目录

使用方式:-s, --saveDir

nomi-oss-upload --saveDir testDir

⚠️注意:目录后不需要/,如果是多层级目录可以写成parent/child格式。

urlFile

本地配置文件路径(相对路径),文件中包含要上传的远端url列表,文件格式为 json

json文件内容格式如下:

[
    "https://example.com/test.png",
    "https://example.com/test.jpg",
    "https://example.com/test.docx",
    "https://example.com/test.ppt",
    "https://example.com/test.json"
    // ...
]

使用方式:-uf, --urlFile

nomi-oss-upload --urlFile path/to/example.config.json

url

待上传的远端url(完整的有效路径)

使用方式:-u, --url

nomi-oss-upload --url https://example.com/example.jpg

random

是否随机生成文件名称

使用方式:-r, --random

nomi-oss-upload --random

debug

是否开启调试模式

使用方式:-d, --debug

nomi-oss-upload --debug