Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rootsongjc/cloudinary-go
A Go client library and CLI tool to upload static assets to Cloudinary service.
https://github.com/rootsongjc/cloudinary-go
cli cloudinary cloudinary-library golang
Last synced: 7 days ago
JSON representation
A Go client library and CLI tool to upload static assets to Cloudinary service.
- Host: GitHub
- URL: https://github.com/rootsongjc/cloudinary-go
- Owner: rootsongjc
- Created: 2017-10-29T06:14:44.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-29T08:22:07.000Z (about 7 years ago)
- Last Synced: 2024-12-15T04:48:20.909Z (12 days ago)
- Topics: cli, cloudinary, cloudinary-library, golang
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Cloudinary-go
=============A Go client library and CLI tool to upload static assets to the [Cloudinary](http://www.cloudinary.com) service.
Installation
------------Install the CLI tool and the library with:
```
go get github.com/rootsongjc/cloudinary-go/cloudinary
```Or download the release binary from [release](https://github.com/rootsongjc/cloudinary-go/releases).
## Configuration
Create a default configuration file named `${HOME}/.cloudinary.toml`
```
[cloudinary]
uri=cloudinary://api_key:api_secret@cloud_name # check your cloudinary dashboard to the the uri
prepend = "images" # default cloudinary folder
```Usage
-----```
A CLI tool to upload static assets to the Cloudinary service.Usage:
cloudinary [command]Available Commands:
help Help about any command
ls List files
put Upload file
rm Remove fileFlags:
--config string config file (default is $HOME/.cloudinary.toml)
-h, --help help for cloudinary
-i, --image string image filename or public id
-p, --path string flle prepend path
-r, --raw string raw filename or public id
-s, --simulate simulate, do nothing (dry run)
-v, --verbose verbose outputUse "cloudinary [command] --help" for more information about a command.
```Type ``cloudinary`` in the terminal to get some help.
### Upload
```bash
# upload image file
cloudinary put -i abc.jpg -p images
# upload raw file
cloudinary put -r abc.js -p js
```As the local image uploaded to cloudinary, you will get a URL such like this:
```bash
cloudinary put -i cover.jpg
Using config file: /Users/jimmy/.cloudinary.toml
Warning: database not set (upload sync disabled)
Default remote prepend path set to: images/
==> PublicID: images/cover
==> Uploading as images
2017/10/29 14:49:01 Uploading: cover.jpg
2017/10/29 14:49:06 URL: https://res.cloudinary.com/jimmysong/image/upload/images/cover.jpg
```The URL `https://res.cloudinary.com/jimmysong/image/upload/images/cover.jpg` represent the laster version of the image.
You can use `ls` to get the upload version.
### List
```bash
# list all resources
cloudinary ls
# list specified static file details
cloudinary ls -i abc -p images
```List raw file details not support.
Get the upload version.
```bash
cloudinary ls -i cover.jpg
Using config file: /Users/jimmy/.cloudinary.toml
Warning: database not set (upload sync disabled)
Default remote prepend path set to: images/
==> PublicID: images/cover
==> Image Details:
public_id Format Version Type Size(KB) Width Height Url
images/cover jpg 1509259745 image 297 1800 2360 http://res.cloudinary.com/jimmysong/image/upload/v1509259745/images/cover.jpg
```**Note**: Whether You can specify the file name with extension name or not, that also works.
### Delete
```bash
# delete image
cloudinary delete -i abc -p images
# delete raw resource
cloudinary delete -r abc.js -p js
```## Note
1. Cloudinary prepend path should not start with a "/" root path
### PublicID
1. PublicID of **Image resource** doesn't include their extension name
2. PublicID of **Raw resource** include their extension name
3. PublicID includes the prepend path**PublicID example**
| Local file | Prepend path | PublicID |
| ---------- | ------------ | ---------- |
| abc.jpg | images | images/abc |
| abc.js | js | js/abc.js |More information see [Cloudinary Image upload API reference](https://cloudinary.com/documentation/image_upload_api_reference)