logo
0
0
WeChat Login

coscli-bin

简体中文 | English

Tencent COS CLI - Node.js wrapper for tencentyun/coscli, the command-line interface for Tencent Cloud Object Storage.

Features

  • 📦 Zero-config auto-installation: npm install and it just works
  • 🔄 Version-locked: Package version matches coscli version
  • 🎯 Platform-aware: Automatically downloads the right binary for your OS/arch
  • 🔐 Checksum verification: SHA-256 verification of all downloads
  • 🔧 Customizable: Support for custom mirrors and system-wide binaries
  • 📝 Type-safe: Full TypeScript support with autocomplete

Installation

npm install coscli-bin -D

Or install globally for CLI access:

npm install -g coscli-bin

Usage

CLI

After installation, you can use the coscli command directly. For detailed CLI usage, please refer to the official coscli documentation.

Programmatic API

import coscli from 'coscli-bin'; // Execute commands await coscli.ls(['cos://mybucket/path/']); await coscli.cp(['localfile.txt', 'cos://mybucket/path/']); await coscli.sync(['./local', 'cos://mybucket/path/']); // Or use exec for more control import { exec, execWithOutput } from 'coscli-bin'; // Execute with output await exec('ls', ['cos://mybucket/path/']); // Capture output const { stdout } = await execWithOutput('version'); console.log(stdout);

Configuration

Environment Variables

VariableTypeDescription
COSCLI_OVERRIDE_VERSIONstringInstall a different coscli version (ignores package.json)
COSCLI_SKIP_DOWNLOADbooleanSkip the postinstall binary download
COSCLI_BIN_PATHstringUse a pre-existing coscli binary
COSCLI_MIRROR_BASE_URLstringCustom download mirror URL
COSCLI_SKIP_CHECKSUMbooleanSkip SHA-256 checksum verification
COSCLI_QUIETbooleanSuppress installation output

Examples

Install a specific version:

COSCLI_OVERRIDE_VERSION=1.0.7 npm install coscli

Skip download (useful for CI):

COSCLI_SKIP_DOWNLOAD=1 npm install

Use a custom binary:

COSCLI_BIN_PATH=/usr/local/bin/coscli npm start

Use a custom mirror:

COSCLI_MIRROR_BASE_URL=https://mirror.example.com/coscli npm install

Supported Platforms

  • macOS: amd64, arm64
  • Linux: 386, amd64, arm, arm64
  • Windows: 386, amd64

Development

# Clone the repository git clone https://github.com/your-org/coscli-npm.git cd coscli-npm # Install dependencies npm install # Build npm run build # Run tests npm test

License

MIT

Links

About

No description, topics, or website provided.
Language
TypeScript82.4%
JavaScript17.6%