I'm trying to look for a way to create a .txt File object without saving it to disk in Node.js``. In browser I'd do something like
new File(['file_contents'], 'file_name.txt', {type: 'text/plain'}) The end aim is to create a .txt file object temporarily for my Discord Bot to send as an message attachment.
From the discord.js documentation, I presume I'm supposed to create a Buffer or Stream object representing the file.
没有评论:
发表评论