Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/transloadit/go-sdk
Transloadit's official Go SDK, maintained by the community
https://github.com/transloadit/go-sdk
encoding go sdk transloadit uploading
Last synced: about 2 months ago
JSON representation
Transloadit's official Go SDK, maintained by the community
- Host: GitHub
- URL: https://github.com/transloadit/go-sdk
- Owner: transloadit
- License: mit
- Created: 2014-05-30T12:22:10.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2024-03-05T13:06:58.000Z (10 months ago)
- Last Synced: 2024-10-29T03:40:28.698Z (2 months ago)
- Topics: encoding, go, sdk, transloadit, uploading
- Language: Go
- Homepage: https://transloadit.com
- Size: 2.71 MB
- Stars: 19
- Watchers: 12
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - go-sdk
README
# go-sdk
A **Go** Integration for [Transloadit](https://transloadit.com)'s file uploading and encoding service
## Intro
[Transloadit](https://transloadit.com) is a service that helps you handle file uploads, resize, crop and watermark your images, make GIFs, transcode your videos, extract thumbnails, generate audio waveforms, and so much more. In short, [Transloadit](https://transloadit.com) is the Swiss Army Knife for your files.
This is a **Go** SDK to make it easy to talk to the [Transloadit](https://transloadit.com) REST API.
## Install
```bash
go get github.com/transloadit/go-sdk
```The Go SDK is confirmed to work with Go 1.11 or higher.
## Usage
```go
package mainimport (
"context"
"fmt""github.com/transloadit/go-sdk"
)func main() {
// Create client
options := transloadit.DefaultConfig
options.AuthKey = "YOUR_TRANSLOADIT_KEY"
options.AuthSecret = "YOUR_TRANSLOADIT_SECRET"
client := transloadit.NewClient(options)// Initialize new assembly
assembly := transloadit.NewAssembly()// Add a file to upload
assembly.AddFile("image", "/PATH/TO/FILE.jpg")// Add Instructions, e.g. resize image to 75x75px
assembly.AddStep("resize", map[string]interface{}{
"robot": "/image/resize",
"width": 75,
"height": 75,
"resize_strategy": "pad",
"background": "#000000",
})// Start the upload
info, err := client.StartAssembly(context.Background(), assembly)
if err != nil {
panic(err)
}// All files have now been uploaded and the assembly has started but no
// results are available yet since the conversion has not finished.
// WaitForAssembly provides functionality for polling until the assembly
// has ended.
info, err = client.WaitForAssembly(context.Background(), info)
if err != nil {
panic(err)
}fmt.Printf("You can view the result at: %s\n", info.Results["resize"][0].SSLURL)
}
```## Example
For fully working examples on how to use templates, non-blocking processing and more, take a look at [`examples/`](https://github.com/transloadit/go-sdk/tree/main/examples).
## Documentation
See Godoc for full API documentation.
## License
[MIT Licensed](LICENSE)