We use getLengthSync to add content-length automatically, but in the case where you have streams, you can't really call getLengthSync, you need to use getLength callback to figure out the content-length.
While I do like form-data to explicitly encourage using getLength in readme, having a way so that we don't call getLengthSync when it's not suitable would be great too.
Not that we can't fallback to getLength, but we rather not make this hack to support form-data too complex.
ref:
We use
getLengthSyncto addcontent-lengthautomatically, but in the case where you have streams, you can't really callgetLengthSync, you need to usegetLengthcallback to figure out thecontent-length.While I do like
form-datato explicitly encourage usinggetLengthin readme, having a way so that we don't callgetLengthSyncwhen it's not suitable would be great too.Not that we can't fallback to
getLength, but we rather not make this hack to supportform-datatoo complex.ref: