Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

File and FileReader#512

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
MartinsYong merged 5 commits intojavascript-tutorial:masterfrombemself:master
Nov 1, 2019
Merged

Conversation

bemself
Copy link
Collaborator

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

当前上游最新 commit:0cf94e8f3

所做更改如下:

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

leviding and lycheeEng reacted with thumbs up emoji
@CLAassistant
Copy link

CLAassistant commentedOct 26, 2019
edited
Loading

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@MartinsYongMartinsYong left a comment

Choose a reason for hiding this comment

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

校对完毕,感谢翻译~


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) 中获取文件。
Copy link
Member

Choose a reason for hiding this comment

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

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

- `readAsDataURL(blob)` -- to base64 data url.
因此我们可以用它将一个 blob 转换为其他格式:
- `readAsArrayBuffer(blob)` -- 转换为 `ArrayBuffer`,
- `readAsText(blob, [encoding])` -- 转换为字符串(替代 `TextDecoder`),
Copy link
Member

Choose a reason for hiding this comment

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

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

```smart header="`FileReaderSync`is available forworkersonly"
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)
Copy link
Member

Choose a reason for hiding this comment

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

[类型] -> [变体]


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

Choose a reason for hiding this comment

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

行首多了一个空格


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>`ordrag'n'drop.
除了`Blob`方法和属性,`File`对象还有`fileName` `lastModified`属性,以及从文件系统读取的内部方法。 我们通常从用户输入如 `<input>`或 拖拽(drag'n'drop)来获取 `File` 对象。
Copy link
Member

Choose a reason for hiding this comment

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

[拖拽]前多了一个空格


In many cases though, we don't have to read the file contents. Just as we did withblobs, 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 ofcanvas etc.
但是,多数情况下,我们不必读取文件内容。正如我们处理blobs 一样,我们可以通过`URL.createObjectURL(file)`创建一个短小的 url,并将其指定给`<a>` `<img>`。 这样,文件便可以下载或者呈现为图像,作为画布(canvas)等的一部分。
Copy link
Member

Choose a reason for hiding this comment

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

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

@javascript-translate-bot

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

@bemself
Copy link
CollaboratorAuthor

/done

@MartinsYongMartinsYong merged commite94be7d intojavascript-tutorial:masterNov 1, 2019
@javascript-translate-bot

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

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

@MartinsYongMartinsYongMartinsYong approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@bemself@CLAassistant@javascript-translate-bot@MartinsYong

[8]ページ先頭

©2009-2025 Movatter.jp