New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix files.upload from Buffer with formData options #307
Comments
I too am interested in how to make this happen. I've tried wrapping the Buffer as a Readable stream... no dice. It works if I write my buffer to a temp file and then use |
Took me quite a bit of searching to look for the issue, but it lies in the fact that the module
So the fix would be to supply the extra information that This should be implemented by the SDK in the future, but in the meantime, here's how you'd go about uploading a buffer as a file: web.files.upload(
fileName,
{
file: {
value: fileBufferData,
options: {
filename: fileName,
contentType: 'mime-type', // optional, will be guessed by `form-data` module
knownLength: fileBufferData.length // optional, will be deduced by `form-data` module
}
}
}
); Note: I'm using an undocumented (but 2-year-old) method of forwarding |
@clavin i want to say thank you so much for your help in pinpointing this problem! you rock! im triaging old issues and since this is reproducible, im labeling it as a bug. i hope that someone in the community can pick it up (it seems fairly obvious now that you've spelled out the solution) and send a PR. if not, it may take a little while for it to get picked up given our current prioritization. |
adds file metadata for files.upload, fixes #307
this really saved my day |
trying to get this to work in the deno workspace functions with a file downloaded |
Getting
Error: no_file_data
while uploading Buffer object with files.upload.Stacktrace:
The text was updated successfully, but these errors were encountered: