Skip to content

Client

getClientService (app, options)

Return the client service interface. The client service exposes the custom methods defined in the Service and is also decorated with 2 helper functions that really simplify the logic when implementing a client application, notably for multipart upload.

ArgumentDescriptionRequired
appthe Feathers client applicationyes
optionsthe options to pass to the client serviceno

The options are:

OptionsDescriptionDefault
transportthe transport layer used by the Feathers client application. For now it is required.
servicePaththe path to the service.s3
chunkSizethe size of the chunk to perfom multipart upload.5MB
useProxydefine whether to use backend as a proxy for custom methods.false
fetchthe fetch function.browser fetch function
btoathe binary to ascii function used to transform sent data into a string.transform to base64
atobthe ascii to binary function used to transform received data into a Buffer.transform from base64
debugthe debug function.null

upload (id, blob, options)

Upload a Blob object to the bucket with the given key id.

According the size of chunk you set when instanciang the client service and the size of the blob, the method will automatically perform a singlepart upload or a mulitpart upload.

If the proxy option is undefined. The client performs the upload action directly using fetch. Otherwise, it uses the proxyUpload custom method.

ArgumentDescriptionRequired
idthe object key. Note that the final computed Key takes into account the prefix option of the service.yes
blobthe content of the object to be uploaded defined as a Blob.yes
optionsoptions to be forwarded to the underlying service methods.no

download (key, type, options)

Download an object from the bucket with the given key id.

If the proxy option is undefined. The client performs the download action directly using fetch. Otherwise, it uses the getObject custom method.

ArgumentDescriptionRequired
idthe object key. Note that the final computed Key takes into account the prefix option of the service.yes
typethe type of the content to be downloaded.yes
optionsoptions to be forwarded to the underlying service methods.no