Skip to content

Commit d2899a9

Browse files
committed
feat: moyu
1 parent 1b37f2a commit d2899a9

File tree

2 files changed

+52
-4
lines changed

2 files changed

+52
-4
lines changed

README.md

+23-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
# 前端博客
1+
# Akara's FrontEnd Blog
2+
3+
## 目录
4+
5+
- [JavaScript](https://messiahhh.github.io/blog/docs/javascript/basic)
6+
- [TypeScript](https://messiahhh.github.io/blog/docs/typescript/config)
7+
- [Node](https://messiahhh.github.io/blog/docs/node/module)
8+
- Vue(停止迭代)
9+
- [React](https://messiahhh.github.io/blog/docs/react/)
10+
- [前端工程化](https://messiahhh.github.io/blog/docs/infra/%E5%89%8D%E7%AB%AF%E5%B7%A5%E7%A8%8B%E5%8C%96)
11+
- [Babel](https://messiahhh.github.io/blog/docs/infra/Babel)
12+
- [Webpack](https://messiahhh.github.io/blog/docs/infra/Webpack)
13+
- [Testing](https://messiahhh.github.io/blog/docs/infra/Test)
14+
- [ESlint And Prettier](https://messiahhh.github.io/blog/docs/infra/ESLint-and-Prettier)
15+
- [浏览器原理相关](https://messiahhh.github.io/blog/docs/browser)
16+
- [GIT](https://messiahhh.github.io/blog/docs/git)
17+
- [计算机网络相关](https://messiahhh.github.io/blog/docs/%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%BD%91%E7%BB%9C)
18+
- [前端安全相关](https://messiahhh.github.io/blog/docs/%E5%89%8D%E7%AB%AF%E5%AE%89%E5%85%A8)
19+
- [编译相关](https://messiahhh.github.io/blog/docs/%E7%BC%96%E8%AF%91%E5%8E%9F%E7%90%86)(学习中)
20+
- [Rust](https://messiahhh.github.io/blog/docs/rust/)(学习中)
21+
- [WebGL](https://messiahhh.github.io/blog/docs/canvas)(学习中)
22+
- [音视频相关](https://messiahhh.github.io/blog/docs/%E9%9F%B3%E8%A7%86%E9%A2%91%E5%AD%A6%E4%B9%A0)(学习中)
23+
224

3-
Learning by default
425

docs/node/stream.md

+29-2
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ new Uint8Array([100, 200, 300])
137137

138138
## String and Encoding
139139

140-
### 字符集与编码
140+
### 字符集与编码方式
141141
无论是`Buffer`还是`ArrayBuffer`,本质上都表示着内存中的二进制数据(或者叫字节序列),通过某种编码方式我们就能获取其对应的字符串。常见的编码方式有`ascii``gbk``utf-8``utf-16`等。
142142

143143
需要注意的是我们平常所说的Unicode指的是一种字符集,表示字符和码点(CodePoint)的一对一映射关系,根据采用的编码方式的不同(`utf-8``utf-16``utf-32`),同一个码点可以对应不同的二进制表示。
@@ -343,7 +343,34 @@ el.files[0] // File
343343

344344

345345

346-
## 闭环转换
346+
## FormData
347+
348+
通常当我们需要给后端发送文件时,要么直接把单个文件内容作为请求体,要么通过`formData`来进行数据传输。
349+
350+
``` javascript
351+
// 错误
352+
fetch(url, {
353+
data: {
354+
file: new File(), // 会被JSON.stringify序列化
355+
name: 'akara',
356+
}
357+
})
358+
359+
// 正确
360+
const formData = new FormData();
361+
formData.append('file', new File());
362+
formData.append('name', 'akara')
363+
364+
fetch(url, {
365+
data: formData
366+
})
367+
```
368+
369+
370+
371+
372+
373+
## 总结
347374

348375
通过上述几节我们了解到`ArrayBuffer``String``Blob`的基本情况,并且知道它们直接是可以进行闭环任意转化的:
349376

0 commit comments

Comments
 (0)