import FormData from "form-data" ; import fetch from "node-fetch" ; export default async ( buffer , preSignedPostPayload ) => { const formData = new FormData ( ) ; Object . keys ( preSignedPostPayload . fields ) . forEach ( key => { formData . append ( key , preSignedPostPayload . fields [ key ] ) ; } ) ; formData . append ( "file" , buffer ) ; return fetch ( preSignedPostPayload . url , { method : "POST" , body : formData } ) ; } ;