Does components v2's FileComponent allow for previewing the attachment within discord?

I'm attaching a plaintext (text/plain; utf-8) txt using Component V2's FileComponent, loaded in from a buffer. The attachment is available where I want it within the message structure -- but only as a downloadable attachment, not as a preview. Am I doing something wrong or is it not possible to have file preview when using a FileComponent?
const fileName = 'input.txt';
const filePath path.join('C:\\path\\to\\file\\', fileName);
const fileContent = await fs.readFile(filePath, 'utf8');

const example = new AttachmentBuilder(Buffer.from(fileContent), {
name: 'example_dump.txt',
contentType: 'text/plain; utf-8'
});
const fileComponent = new FileBuilder().setURL('attachment://example.txt');

channel.send({
flags: MessageFlags.IsComponentsV2,
components: [
fileComponent
],
files:[ example ],
});
const fileName = 'input.txt';
const filePath path.join('C:\\path\\to\\file\\', fileName);
const fileContent = await fs.readFile(filePath, 'utf8');

const example = new AttachmentBuilder(Buffer.from(fileContent), {
name: 'example_dump.txt',
contentType: 'text/plain; utf-8'
});
const fileComponent = new FileBuilder().setURL('attachment://example.txt');

channel.send({
flags: MessageFlags.IsComponentsV2,
components: [
fileComponent
],
files:[ example ],
});
There is other stuff componentV2 stuff in the message as well. thanks in advance.
3 Replies
d.js toolkit
d.js toolkit3d ago
haezee
haezeeOP3d ago
npm list discord.js
warpmng_selenium@1.0.0 X:\haezee\workspace\warpmng_selenium
└── discord.js@14.22.1
npm list discord.js
warpmng_selenium@1.0.0 X:\haezee\workspace\warpmng_selenium
└── discord.js@14.22.1
node -v
v22.20.0
node -v
v22.20.0
Ah, that explains then
d.js toolkit
d.js toolkit2d ago
The issue has been marked as solved by support staff

Did you find this page helpful?