Thursday 21 March 2019

Creating a library that can upload files from both the backend and frontend?

A service I run has an API endpoint that allows people to upload files using multipart/form-data standards. I'm currently attempting to build an SDK for this service and I'd like to have this SDK work on both the front-end and the backend (as many libraries do).​I can't use things like fs on the frontend, and I can't things like FormData on the node apps. Which makes things interesting.​I'm curious if there's a commonality between front-end and backend uploads that I can exploit to make this happen. Ideally I'd like to avoid just having a dumb function that takes a multipart body to send off via axios, since this kind of defeats the purpose of having an SDK in the first place.​Is this a fools errand?​thanks in advance for any advice!

Submitted March 21, 2019 at 07:51PM by RockBand2

No comments:

Post a Comment