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

fix: file size unit #1320

Merged
merged 3 commits into from
Jun 28, 2024
Merged

fix: file size unit #1320

merged 3 commits into from
Jun 28, 2024

Conversation

hualigushi
Copy link
Contributor

@hualigushi hualigushi commented Jun 27, 2024

Summary by CodeRabbit

  • 功能更新
    • 更新了human_readable_size函数中用于人类可读大小转换的单位,从"kB"、"mB"、"gB"调整为"kB"、"MB"、"GB"。

Copy link
Contributor

coderabbitai bot commented Jun 27, 2024

摘要

Walkthrough

这次的变更主要涉及在 crates/mako 模块的 stats.rs 文件中的 human_readable_size 函数中更新用于人类可读大小转换的单位,从 "kB", "mB", "gB" 更改为 "kB", "MB", "GB"。

Changes

文件路径 变更摘要
crates/mako/src/stats.rs 更新 human_readable_size 函数中的单位数组,从 ["kB", "mB", "gB"] 更改为 ["kB", "MB", "GB"]

诗歌

代码兔欢跳庆更新,

大小写单位舞光明。

从小写到大写调变化,

代码世界变得更加亮。

更新如诗般优雅。🐇🌟


Note

Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://coderabbit.ai

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@@ -447,7 +447,7 @@ pub fn write_stats(stats: &StatsJsonMap, compiler: &Compiler) {

// 文件大小转换
pub fn human_readable_size(size: u64) -> String {
let units = ["kB", "mB", "gB"];
let units = ["kB", "MB", "GB"];
Copy link
Member

Choose a reason for hiding this comment

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

为啥 kB 不一起大写了

Copy link
Contributor Author

@hualigushi hualigushi Jun 28, 2024

Choose a reason for hiding this comment

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

浏览器 network 显示的是 kB MB , webpack 也是这样显示的
k 是 kilo,M 是 mega,G 是 giga

Copy link
Contributor

Choose a reason for hiding this comment

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

kB 和 KB 是用来表示计算机数据存储容量的单位,它们的区别在于所代表的容量大小不同:

  1. kB (kilobyte):

    • 在计算机科学中,1 kB 通常等于 1024 字节 (bytes)。这是因为计算机是基于二进制系统的,1024 是 2 的 10 次方。
    • 有时在某些上下文中,特别是国际标准组织(ISO)推荐的使用下,1 kB 也可以表示 1000 字节。为了避免混淆,这种情况下更常使用 "kB" 表示 1000 字节,而使用 "KiB"(kibibyte)表示 1024 字节。
  2. KB (Kilobyte):

    • 通常用来表示 1000 字节,这是根据国际单位制(SI)前缀定义的。SI 前缀 “Kilo” 表示 1000。
    • 然而在很多实际应用中,KB 和 kB 都常被混用来表示 1024 字节,特别是在传统计算机领域。

为了更清晰的区分,国际电工委员会(IEC)推荐使用二进制前缀:

  • KiB (kibibyte): 1 KiB = 1024 字节 (2¹⁰ bytes)
  • KB (kilobyte): 1 KB = 1000 字节 (10³ bytes)

总结:

  • kB 或 KiB 通常用于表示 1024 字节。
  • KB 通常用于表示 1000 字节,但在某些情况下,可能也表示 1024 字节。

在使用过程中,了解上下文和具体用法是很重要的,以避免混淆。

@afc163 afc163 merged commit 7e2d9e4 into master Jun 28, 2024
8 checks passed
@afc163 afc163 deleted the fix/file-size-unit branch June 28, 2024 04:02
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.

3 participants