import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
binary_short = client.fastedge.binaries.create(
b"Example data",
)
print(binary_short.id)package main
import (
"bytes"
"context"
"fmt"
"io"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
binaryShort, err := client.Fastedge.Binaries.New(context.TODO(), io.Reader(bytes.NewBuffer([]byte("Example data"))))
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", binaryShort.ID)
}
curl --request POST \
--url https://api.gcore.com/fastedge/v1/binaries/raw \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/octet-stream'},
body: JSON.stringify('<string>')
};
fetch('https://api.gcore.com/fastedge/v1/binaries/raw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/fastedge/v1/binaries/raw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/fastedge/v1/binaries/raw")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/octet-stream")
.body("\"<string>\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/fastedge/v1/binaries/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/octet-stream'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_body{
"id": 123,
"status": 123,
"api_type": "<string>",
"unref_since": "<string>",
"checksum": "<string>",
"source": 1
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Store compiled WASM binary
Upload a compiled WebAssembly binary to the edge platform. The binary is automatically analyzed to detect its API type (WASI or Proxy-WASM) and stored for use in applications. Maximum binary size is 100MB.
import os
from gcore import Gcore
client = Gcore(
api_key=os.environ.get("GCORE_API_KEY"), # This is the default and can be omitted
)
binary_short = client.fastedge.binaries.create(
b"Example data",
)
print(binary_short.id)package main
import (
"bytes"
"context"
"fmt"
"io"
"github.com/G-Core/gcore-go"
"github.com/G-Core/gcore-go/option"
)
func main() {
client := gcore.NewClient(
option.WithAPIKey("My API Key"),
)
binaryShort, err := client.Fastedge.Binaries.New(context.TODO(), io.Reader(bytes.NewBuffer([]byte("Example data"))))
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", binaryShort.ID)
}
curl --request POST \
--url https://api.gcore.com/fastedge/v1/binaries/raw \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/octet-stream' \
--data '"<string>"'const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/octet-stream'},
body: JSON.stringify('<string>')
};
fetch('https://api.gcore.com/fastedge/v1/binaries/raw', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/fastedge/v1/binaries/raw",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode('<string>'),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/octet-stream"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/fastedge/v1/binaries/raw")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/octet-stream")
.body("\"<string>\"")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/fastedge/v1/binaries/raw")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/octet-stream'
request.body = "\"<string>\""
response = http.request(request)
puts response.read_body{
"id": 123,
"status": 123,
"api_type": "<string>",
"unref_since": "<string>",
"checksum": "<string>",
"source": 1
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234_abcdef
Body
The body is of type file.
Response
Binary stored successfully, returns binary metadata
Binary ID
Status code:
0 - pending
1 - compiled
2 - compilation failed (errors available)
3 - compilation failed (errors not available)
4 - resulting binary exceeded the limit
5 - unsupported source language
Wasm API type
Not used since (UTC)
MD5 hash of the binary
Source language:
0 - unknown
1 - Rust
2 - JavaScript
3 - Go
0 <= x <= 3Was this page helpful?