node-wpapi
node-wpapi copied to clipboard
Unable to load media using path or buffer in electron app
Environment
- electron: "9.1.0"
- node: "12.14.1"
- wpapi: "1.2.1"
- Windows 10
I'm trying to execute the following code in the electron application in a dedicated worker.
const filePath = 'path/to/local/file' // or fs.readFile('path/to/file')
const media = await site.media().file(filePath).create({ post: wpPost.id });
Error:
TypeError: Failed to execute 'append' on 'FormData': parameter 2 is not of type 'Blob'.
at Request../node_modules/superagent/lib/client.js.Request.attach (client.js:577)
at Object._httpPost [as post] (http-transport.js:301)
at EndpointRequest../node_modules/wpapi/lib/constructors/wp-request.js.WPRequest.create (wp-request.js:734)
Same error for me. but It's not Electron specific because I use React and got the same error
Same error here. Any possible solution?