https://github.com/bencode/oss-upload
upload local static files to ali oss.
https://github.com/bencode/oss-upload
Last synced: 11 months ago
JSON representation
upload local static files to ali oss.
- Host: GitHub
- URL: https://github.com/bencode/oss-upload
- Owner: bencode
- Created: 2018-08-20T04:46:11.000Z (over 7 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T04:58:30.000Z (about 2 years ago)
- Last Synced: 2025-04-07T05:44:22.883Z (12 months ago)
- Language: JavaScript
- Homepage:
- Size: 672 KB
- Stars: 4
- Watchers: 2
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# oss-upload
## Usage
### 1. Installation
To install, run the following command:
```shell
npm install --save-dev ali-oss-upload-cli
```
### 2. Update the .env File
Configure your environment variables as follows:
```
OSS_REGION=oss-cn-hangzhou
OSS_BUCKET=lesscap
OSS_ACCESS_KEY_ID=xxx
OSS_ACCESS_KEY_SECRET=xxx
```
**Important: Ensure the .env file is added to your .gitignore to protect your credentials.**
### 3. Upload Files
To upload the dist directory to the remote /static directory, use:
```
oss-upload dist -o /static
```
To upload to the bucket's root directory:
```
oss-upload dist -o /
```
To filter files using glob patterns (e.g., only .js files):
```
oss-upload dist -o /static --filter=**/*.js
```
For CI environments, you can specify all parameters directly in the command line for convenience:
```
oss-upload dist -o /static --region=oss-cn-hangzhou --bucket=lesscap --key=xxx --secret=xxx
```
To specify a different .env file:
```
oss-upload dist -o /static --envfile=.env.test
```
### 4. Display Help
To view all available commands and options, run:
```
oss-upload -h
```