GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — File and FileReader · Pull Request #512 · javascript-tutorial/zh.javascript.info

Conversation

@ghost

@ghost ghost commented Oct 26, 2019

Copy link
Copy Markdown

目标章节:4-binary/04-file/article

当前上游最新 commit:0cf94e8f3

所做更改如下:

文件名 参考上游 commit 更改(理由)
article.md 0cf94e8 新翻译首次提交

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

leviding and lycheeEng reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
bemself added 3 commits October 14, 2019 22:25
bemself
init zh trans
38df56e
doituself
update trans
37275c9
bemself
update trans
0cf94e8
@javascript-translate-bot javascript-translate-bot added the review needed label Oct 26, 2019
@javascript-translate-bot
javascript-translate-bot requested a review from a team October 26, 2019 12:49
@iliakan iliakan mentioned this pull request Oct 26, 2019
Chinese Translation Progress #324
Closed
@CLAassistant

CLAassistant commented Oct 26, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

MartinsYong
MartinsYong suggested changes Oct 30, 2019
View reviewed changes

@MartinsYong MartinsYong left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

校对完毕,感谢翻译~

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
- **`lastModified`** -- 上次更新的时间戳(整型日期)。

Second, more often we get a file from `<input type="file">` or drag'n'drop or other browser interfaces. Then the file gets these from OS.
其次,我们经常从 `<input type="file">` 或 拖拽 或 其他浏览器接口来获取。 然后,再从操作系统(OS) 中获取文件。

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[拖拽]这里两边的空格可以去掉

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
- `readAsDataURL(blob)` -- to base64 data url.
因此我们可以用它将一个 blob 转换为其他格式:
- `readAsArrayBuffer(blob)` -- 转换为 `ArrayBuffer`,
- `readAsText(blob, [encoding])` -- 转换为字符串(替代 `TextDecoder`),

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[替代 TextDecoder] -> [TextDecoder 的一个替代]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
```smart header="`FileReaderSync` is available for workers only"
For Web Workers, there also exists a synchronous variant of `FileReader`, called [FileReaderSync](https://www.w3.org/TR/FileAPI/#FileReaderSync).
```smart header="`FileReaderSync` 只适用于 workers "
对于 Web Workers,还有一种同步的 `FileReader` 类型,称为 [FileReaderSync](https://www.w3.org/TR/FileAPI/#FileReaderSync)。

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[类型] -> [变体]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
对于 Web Workers,还有一种同步的 `FileReader` 类型,称为 [FileReaderSync](https://www.w3.org/TR/FileAPI/#FileReaderSync)。

Its reading methods `read*` do not generate events, but rather return a result, as regular functions do.
FileReader 的读取方法 `read*` 并不生成事件,而是会和普通函数一样返回一个结果。

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

行首多了一个空格

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
`File` 对象继承自 `Blob`。

In addition to `Blob` methods and properties, `File` objects also have `fileName` and `lastModified` properties, plus the internal ability to read from filesystem. We usually get `File` objects from user input, like `<input>` or drag'n'drop.
除了 `Blob` 方法和属性,`File` 对象还有 `fileName` 和 `lastModified` 属性,以及从文件系统读取的内部方法。 我们通常从用户输入如 `<input>` 或 拖拽(drag'n'drop)来获取 `File` 对象。

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[拖拽]前多了一个空格

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread 4-binary/04-file/article.md Outdated
- 数据 url,base-64 编码(`readAsDataURL`)。

In many cases though, we don't have to read the file contents. Just as we did with blobs, we can create a short url with `URL.createObjectURL(file)` and assign it to `<a>` or `<img>`. This way the file can be downloaded or shown up as an image, as a part of canvas etc.
但是,多数情况下,我们不必读取文件内容。正如我们处理 blobs 一样,我们可以通过 `URL.createObjectURL(file)` 创建一个短小的 url,并将其指定给 `<a>` 或 `<img>`。 这样,文件便可以下载或者呈现为图像,作为画布(canvas)等的一部分。

@MartinsYong MartinsYong Oct 30, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

[指定给] -> [赋值给]

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@javascript-translate-bot javascript-translate-bot removed the review needed label Oct 30, 2019
@javascript-translate-bot

javascript-translate-bot commented Oct 30, 2019

Copy link
Copy Markdown

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@javascript-translate-bot javascript-translate-bot added the changes requested label Oct 30, 2019
bemself
Make changes after 1st review
b38c7ec
@ghost

ghost commented Oct 31, 2019

Copy link
Copy Markdown
Author

/done

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@javascript-translate-bot javascript-translate-bot added review needed and removed changes requested labels Oct 31, 2019
@javascript-translate-bot
javascript-translate-bot requested a review from a team October 31, 2019 13:50
@MartinsYong
fix: 一点小更改
2e7c4d7
MartinsYong
MartinsYong approved these changes Nov 1, 2019
View reviewed changes
@javascript-translate-bot javascript-translate-bot added needs +1 and removed review needed labels Nov 1, 2019
@MartinsYong
MartinsYong merged commit e94be7d into javascript-tutorial:master Nov 1, 2019
@javascript-translate-bot

javascript-translate-bot commented Nov 1, 2019

Copy link
Copy Markdown

Thank you 💖 I updated the Progress Issue #324 🎉 🎉 🎉

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

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

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs +1

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@CLAassistant @javascript-translate-bot @MartinsYong
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.