https://github.com/cnpm/cos-cnpm
tencent-cloud cos wrapper for cnpm
https://github.com/cnpm/cos-cnpm
Last synced: 10 months ago
JSON representation
tencent-cloud cos wrapper for cnpm
- Host: GitHub
- URL: https://github.com/cnpm/cos-cnpm
- Owner: cnpm
- Created: 2017-05-06T03:29:58.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-05T10:24:40.000Z (over 3 years ago)
- Last Synced: 2025-08-09T03:45:30.924Z (10 months ago)
- Language: JavaScript
- Size: 32.2 KB
- Stars: 1
- Watchers: 12
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
README
# cos-cnpm
fs storage wrapper for cnpm
## Installation
```bash
$ npm install cos-cnpm
```
## Warning!!!
Only support singleton. Don't initialize two `cos-cnpm` instance.
## Usage
```js
import COSClient from 'cos-cnpm';
config.nfs = {
client: new COSClient({
secretId: '',
secretKey: '',
bucket: '',
region: '',
}),
// dir: join(config.dataDir, 'nfs'),
};
```
## API
All the APIs are following [cnpm nfs guide](https://github.com/cnpm/cnpmjs.org/wiki/NFS-Guide).
- `upload`: upload a file from filepath
- `uploadBuffer`: upload a file from buffer
- `download`: download file by key
- `remove`: remove file by key
- `uploadBytes`: upload bytes
- `appendBytes`: append bytes
- `readBytes`: read bytes
- `list`: list files by prefix
- `url`: get download url
- `urls`: get download urls
### License
MIT