Comments (1)
I ended up to do send fetch request myselft and it solved the problem
const title = params.title;
const fd = new FormData();
fd.append("title", title);
fd.append("caption", title);
fd.append("alt_text", title);
fd.append("description", title);
fd.append("file", new Blob([buffer]), filename);
const headers = new Headers();
headers.append(
"Content-Disposition",
'attachment; filename="' + "files.jpeg" + '"',
);
const auth = `Basic ${Buffer.from(username + ":" + password).toString(
"base64",
)}`;
headers.append("Authorization", auth);
const response = await fetch(`https://${project.url}/wp-json/wp/v2/media`, {
method: "POST",
headers,
body: fd,
});
const media = (await response.json()) as WpMedia;
return media;
from node-wpapi.
Related Issues (20)
- Wordpress 5.9 templates endpoint regex problem HOT 2
- Regex error when using WPAPI.discover HOT 3
- IPV6 only sites are not working HOT 1
- Outdated Superagent dep causing error for serverless functions
- is this project abandoned? HOT 1
- Failed to Enable Auto-Discovery
- SyntaxError when calling wp.media() function
- How do I get the href to a featured image? HOT 1
- Create a post with hyperlink HOT 1
- WPRequest 'update' method defined as private
- Getting raw content with css classes injected but without css code
- search, slug, limit per page and offset functionality not working
- I do something opposite I want to receive data from node.js in WordPress
- [istanbul] Some internal modules are deprecated.
- [@babel/plugin-proposal-object-rest-spread] Some internal modules are deprecated.
- [grunt-cli] Some internal modules are deprecated.
- [jest] Some internal modules are deprecated.
- [grunt] Some internal modules are deprecated.
- [grunt-contrib-clean] Some internal modules are deprecated.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-wpapi.