A string representing the file URL, a file upload ID, or an options object.
The URL for the file.
The ID of the file upload.
The name of the file.
The caption as a string, an array of strings, or an array of rich text objects.
A file block object compatible with Notion's API, or null if the URL/ID is invalid.
// Use with a file URL
const externalFile = block.file.createBlock("https://collegeinfogeek.com/wp-content/uploads/2015/01/10steps-reddit.pdf");
// Use with a file upload ID
const fileUploadFile = block.file.createBlock("123e4567-e89b-12d3-a456-426614174000");
// Use with options object for external file
const externalFile = block.file.createBlock({
url: "https://collegeinfogeek.com/wp-content/uploads/2015/01/10steps-reddit.pdf",
name: "10 Steps to Earning Awesome Grades (preview)",
caption: "The Reddit preview of the 10 Steps to Earning Awesome Grades book."
});
// Use with options object for file upload
const fileUploadFile = block.file.createBlock({
id: "123e4567-e89b-12d3-a456-426614174000",
name: "10 Steps to Earning Awesome Grades (preview)",
caption: "The Reddit preview of the 10 Steps to Earning Awesome Grades book."
});
Creates a file block.