为什么要使用 blob?
Why are blobs used?
Blob 是线性大对象,但为什么要使用它们,尤其是在 JavaScript 的上下文中?
如果你搜索 interwebz,你会得到很多 blob 的定义,但不知道为什么要使用它们。
所以我的问题是:
- 为什么? (在什么情况下,用例?)
- 特别是关于 Cordova 中的文件存储(因此通过 JavaScript)
- 使用 blob 时附加值是什么。
示例:
将数据存储到文件系统时(通过 JavaScript),教程在存储之前首先将 String 转换为 blob。但为什么?您可以只将 String 值写入文件,它不需要是一个 blob。
编辑:可以看到在 Cordova 中使用 blob 的示例 here
提前致谢!
What is the added value when working with blobs.
Example: When storing data to the filesystem (by means of JavaScript),
tutorials first convert the String to a blob before its stored. But
Why? You could just write the String value to a file, it doesn't need
to be a blob.
一个Blob
可以存储String
、Number
、Array
、ArrayBuffer
、Boolean
单个或多个File
对象,继承自 Blob
,或多个 Blob
s.
使用 Blob
而不是 String
的一个示例优势是在单个 Blob
中存储单个或多个 File
对象,而不是可能冗长的 data URI
,或 data URI
在 data URI
.
中
Blob 是线性大对象,但为什么要使用它们,尤其是在 JavaScript 的上下文中?
如果你搜索 interwebz,你会得到很多 blob 的定义,但不知道为什么要使用它们。
所以我的问题是:
- 为什么? (在什么情况下,用例?)
- 特别是关于 Cordova 中的文件存储(因此通过 JavaScript)
- 使用 blob 时附加值是什么。
示例: 将数据存储到文件系统时(通过 JavaScript),教程在存储之前首先将 String 转换为 blob。但为什么?您可以只将 String 值写入文件,它不需要是一个 blob。
编辑:可以看到在 Cordova 中使用 blob 的示例 here
提前致谢!
What is the added value when working with blobs.
Example: When storing data to the filesystem (by means of JavaScript), tutorials first convert the String to a blob before its stored. But Why? You could just write the String value to a file, it doesn't need to be a blob.
一个Blob
可以存储String
、Number
、Array
、ArrayBuffer
、Boolean
单个或多个File
对象,继承自 Blob
,或多个 Blob
s.
使用 Blob
而不是 String
的一个示例优势是在单个 Blob
中存储单个或多个 File
对象,而不是可能冗长的 data URI
,或 data URI
在 data URI
.