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

multi-coscmd

v1.0.9

Published

支持本地同时存在多个coscmd的配置,并在使用时自动切换到对应的配置

Downloads

6

Readme

目的

腾讯的coscmd本身只支持本地同时存在一个桶的配置,每次调用coscmd config都会覆盖~/.cos.conf中的配置,如果需要同时向不同的桶上传文件的话还需要先进行本地~/.cos.conf的写操作,非常不合理。我比较倾向的是跟ssh的配置一样,一个配置文件可以同时支持多个桶的操作。

安装

由于需要对coscmd可执行文件进行修改,所以需要sudo --unsafe

sudo npm install -g multi-coscmd --unsafe

原理

相当于hook了coscmd本身的操作。目前对以下操作进行了hook:

  • coscmd config: 在本地生成或更新~/.cos.conf文件之后会将文件内容写到包含所有桶的配置文件~/.cos.conf.all中。
  • 其他使用-b指定桶的操作: 如果~/.cos.conf.all中存在指定桶的配置则会先将~/.cos.conf切换到对应的配置,然后再继续原有操作。

使用方式

因为只是添加了hook,所以与直接使用coscmd一样,另外添加了以下操作:

  • coscmd -a: 输出~/.cos.conf.all文件内容到控制台
  • coscmd reset: 删除所有的hook以及其他附加操作,但是~/.cos.conf.all文件会保留
// 可以连续配置多个桶
coscmd config -a SECRET_ID -s SECRET_KEY -b bucket1-beijing -r ap-beijing
coscmd config -a SECRET_ID -s SECRET_KEY -b bucket2-hongkong -r ap-hongkong

// 会打印上述两个配置
coscmd -a

// 以后就可以直接使用-b指定不同的桶进行文件操作
coscmd -b bucket1-beijing upload exampleobject exampleobject
coscmd -b bucket2-hongkong upload exampleobject exampleobject