diff --git a/examples/native.js b/examples/native.js index e39d4cb..27f1f53 100644 --- a/examples/native.js +++ b/examples/native.js @@ -1,7 +1,7 @@ import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; import native from 'k6/x/neofs/native'; -const payload = new Uint8Array(open('../go.sum', 'b')); +const payload = open('../go.sum', 'b'); const container = "AjSxSNNXbJUDPqqKYm1VbFVDGCakbpUNH8aGjPmGAH3B" const neofs_cli = native.connect("s01.neofs.devenv:8080", "") diff --git a/examples/s3.js b/examples/s3.js index 244713b..32c6dbe 100644 --- a/examples/s3.js +++ b/examples/s3.js @@ -1,7 +1,7 @@ import { uuidv4 } from 'https://jslib.k6.io/k6-utils/1.2.0/index.js'; import s3 from 'k6/x/neofs/s3'; -const payload = new Uint8Array(open('../go.sum', 'b')); +const payload = open('../go.sum', 'b'); const bucket = "cats" const s3_cli = s3.connect("http://s3.neofs.devenv:8080") diff --git a/internal/native/client.go b/internal/native/client.go index 3de8d41..09ad910 100644 --- a/internal/native/client.go +++ b/internal/native/client.go @@ -5,6 +5,7 @@ import ( "crypto/ecdsa" "time" + "github.com/dop251/goja" "github.com/nspcc-dev/neofs-sdk-go/client" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" "github.com/nspcc-dev/neofs-sdk-go/object" @@ -37,8 +38,8 @@ type ( } ) -func (c *Client) Put(inputContainerID string, headers map[string]string, payload []byte) PutResponse { - rdr := bytes.NewReader(payload) +func (c *Client) Put(inputContainerID string, headers map[string]string, payload goja.ArrayBuffer) PutResponse { + rdr := bytes.NewReader(payload.Bytes()) sz := rdr.Size() // preparation stage diff --git a/internal/s3/client.go b/internal/s3/client.go index c9fc78f..f4db08e 100644 --- a/internal/s3/client.go +++ b/internal/s3/client.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" + "github.com/dop251/goja" "github.com/nspcc-dev/xk6-neofs/internal/stats" "go.k6.io/k6/js/modules" "go.k6.io/k6/metrics" @@ -29,8 +30,8 @@ type ( } ) -func (c *Client) Put(bucket, key string, payload []byte) PutResponse { - rdr := bytes.NewReader(payload) +func (c *Client) Put(bucket, key string, payload goja.ArrayBuffer) PutResponse { + rdr := bytes.NewReader(payload.Bytes()) sz := rdr.Size() stats.Report(c.vu, objPutTotal, 1)