buffer = canvas.toBuffer("image/jpeg");
await fs.writeFileSync(id + ".jpeg", buffer);
(async() => {
var { media } = await client.uploadPhoto({
photo: id + ".jpeg",
caption: "",
post: "feed"
});
console.log(`https://www.instagram.com/p/${media.code}/`);
})();
First I create a buffer to write a file.
Then I write it to the current path with the name of id. In the async function, I try to get a photo as id+"jpeg". However, I don't want to do that because I run it on a server. Servers do not have storages. So it gives an error. I need something like
...client.uploadPhoto({
photo: buffer.toImage(),
caption: "",
post: "feed"
});
Any help is appreciated. Thanks in advance...
The API that I use is this
question from:
https://stackoverflow.com/questions/65642929/how-can-i-use-a-buffer-as-image-without-writing-it-as-a-file-and-read-again 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…