Skip to content

Conversation

gvanhorne
Copy link
Contributor

Closes #1640

docs/files.md Outdated
@@ -52,7 +52,7 @@ const frames = [

None of the files in `frames` above are loaded until a [content method](#supported-formats) is invoked, for example by saying `frames[0].image()`.

For missing files, `file.size` and `file.lastModified` are undefined. The `file.mimeType` is determined by checking the file extension against the [`mime-db` media type database](https://github.com/jshttp/mime-db); it defaults to `application/octet-stream`.
For missing files, `file.size` <a href="https://github.com/observablehq/framework/releases/tag/v1.11.0" class="observablehq-version-badge" data-version="^1.11.0" title="Added in 1.11.0"></a> and `file.lastModified` are undefined. The `file.mimeType` is determined by checking the file extension against the [`mime-db` media type database](https://github.com/jshttp/mime-db); it defaults to `application/octet-stream`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want to add <a href="https://github.com/observablehq/framework/releases/tag/v1.4.0" class="observablehq-version-badge" data-version="^1.4.0" title="Added in 1.4.0"></a> for file.lastModified too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure that makes sense to me! 👍

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the compromise here is that we should explicitly document the names of these fields the first time they are introduced, along with the version at which they were added. Then we won’t repeat the version badge when they are referenced subsequently. The problem with these fields is that we only introduce them as e.g. “size in bytes” and “modification time” rather than file.size and file.lastModified. I’ll make some edits and approve.

Copy link
Member

@mbostock mbostock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, hopefully this makes it more obvious when file.size was added. I’ll merge this but let us know if you’d like further changes. Thank you @gvanhorne!

@mbostock mbostock enabled auto-merge (squash) September 8, 2024 01:43
@mbostock mbostock merged commit 25d986d into observablehq:main Sep 8, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add version badge for reference to file.size
2 participants