Sending a file from nodejs to an SS service using JsonServiceClient

Hi,
When I send a file from c# I do it with:

 client.PostFileWithRequest<UploadFileDirectResponse>
      (inputStream, name, new UploadFileDirectRequest {... });

I don’t see that option in ts client…
BTW, this is the object I’m holding in my hand:

{
  fieldname: 'file',
  originalname: 'logo.png',
  encoding: '7bit',
  mimetype: 'image/png',
  buffer: <Buffer 89 50 4e 47  ... 13895 more bytes>,
  size: 13945
}

How can I send this file to my UploadFileDirectResponse?
Thanks

There’s no API for uploading files with the TypeScript JsonServiceClient.

The standard for uploading files is to use multipart/form-data Content-Type which is the same format used to upload files in HTML browsers. The w3 docs explains the Multipart Content-Type in more detail.

This http-upload.js shows an example of how to do this in node.

1 Like