particle-api-js icon indicating copy to clipboard operation
particle-api-js copied to clipboard

uploadProductFirmware only tests with Buffer, and doesn't test with filename

Open dmiddlecamp opened this issue 6 years ago • 1 comments

in the documentation:

options.file Object Path or Buffer of the new firmware file
                             Either a path or Buffer of the file contents in Node, or a File or Blob in the browser.

test parameter appears to only set file to a buffer, and not a path file: new Buffer('ELF...'),

discovered because upload with path appears to not work as expected during testing / development.

dmiddlecamp avatar Feb 04 '20 16:02 dmiddlecamp

(stream of consciousness, still investigating)

it looks like maybe this isn't working in the browser (maybe just chrome / firefox), seems like it really expects a blob and not a path...

https://github.com/particle-iot/particle-api-js/blob/master/src/Agent.js#L139-L153

Am I correct in thinking this functionality just wasn't tested?

dmiddlecamp avatar Feb 04 '20 16:02 dmiddlecamp