Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: add encoding: utf-8 property to File #391

Open
webketje opened this issue Aug 31, 2023 · 1 comment
Open

Feature: add encoding: utf-8 property to File #391

webketje opened this issue Aug 31, 2023 · 1 comment

Comments

@webketje
Copy link
Member

Before trying to parse front-matter metalsmith.readFile does a utf-8 check, however this information is lost in the build although it could be useful. Proposal would be to add a file.encoding property to files which pass the check

@webketje
Copy link
Member Author

Another thought would be to add file.utf8 instead, because after all what we are most interested in is whether a file is textual content or binary, to determine whether we can do string manipulation. Mime types can be easily added with an npm pkg like https://www.npmjs.com/package/mime-types based on file extension, but the utf-8 check is more expensive because it has to walk through the file byte by byte

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant