当前位置:网站首页>URL.createObjectURL、URL.revokeObjectURL、Uint8Array、Blob使用详解
URL.createObjectURL、URL.revokeObjectURL、Uint8Array、Blob使用详解
2022-08-01 09:39:00 【YF-SOD】
目录
URL.createObjectURL(obj)
返回一个URL 对象表示指定的 File 对象(生成blob:http://www.xxxx.com/xx的链接,可以直接在网页上打开File内容)或 Blob 对象(用于下载)。
obj为 File 对象、Blob 对象或者 MediaSource 对象。
URL.revokeObjectURL(objURL)
在每次调用 createObjectURL() 方法时,都会创建一个新的 URL 对象,即使你已经用相同的对象作为参数创建过。当不再需要这些 URL 对象时,每个对象必须通过调用 URL.revokeObjectURL() 方法来释放。
objURL为URL.createObjectURL(obj) 返回的对象。
create|revokeObjectURL使用示例详解
URL.createObjectURL讲解_定栓的博客-CSDN博客_createobjecturl 文件名
arr=new Uint8Array(length)
返回一个长度为length的8位无符号整型数组(存储大小为0~256,负数会自动加256转为整数,超出-256),创建时内容被初始化为0。
还可以接受参数为数组。
arr.BYTES_PER_ELEMENT
数组中每个元素所占用的字节数,返回为1(Uint16Array时返回为2)。
Uint8Array.subarray
和slice方法相似,区别在于subarray返回的数组中的每一位和原数组的每一位共用一个地址(修改返回数组的内容,原数组内容也会对应修改)
示例
相关方法等详解
new Blob(arr,options)
返回一个blob对象(可理解为二进制的数据对象),常用用于文件下载。
arr为存储的数据;option是可选参数,为一个对象,type属性指定数据的类型,可以为text/html、image/png等;endings属性指定包含行结束符\n的字符串如何被写入,native代表行结束符会被更改为适合宿主操作系统文件系统的换行符,transparent代表会保持 blob 中保存的结束符不变(默认值)。
相关方法等详解
边栏推荐
- Is the real database data of TiDB stored in kv and pd?
- 笔记。。。。
- 基于MySql,Redis,Mq,ES的高可用方案解析
- ClickHouse多种安装方式
- Shell: Conditional test action
- Lsky Pro 企业版手动升级、优化教程
- [Beyond programming] When the fig leaf is lifted, when people begin to accept everything
- 周鸿祎称微软抄袭 360 安全模式后发文否认;英特尔CEO基辛格回应市值被AMD超越:股价下跌是咎由自取|极客头条
- 世界第4疯狂的科学家,在103岁生日那天去世了
- Node's traditional and advanced practices for formatting time (moment)
猜你喜欢

杨辉三角(c语言实现)

使用ESP32驱动QMA7981读取三轴加速度(带例程)

50.【Application of dynamic two-dimensional array】

Explain / Desc 执行计划分析

Shell: Conditional test action

STM32个人笔记-看门狗

Shell:条件测试操作

SAP ABAP OData 服务如何支持 $orderby (排序)操作试读版

Microsoft Azure & NVIDIA IoT developers season I | Azure IoT & NVIDIA Jetson development foundation

The soul asks: How does MySQL solve phantom reads?
随机推荐
redis
Ogg synchronizes oracle to mysql, there may be characters that need to be escaped in the field, how to configure escape?
JVM 运行时数据区与JMM 内存模型详解
Get the Token from the revised version of Qubutu Bed
SkiaSharp 之 WPF 自绘 五环弹动球(案例版)
WLAN networking experiment of AC and thin AP
将Servlet项目改为SSM项目
Custom Types - Enums, Unions
Meeting OA (Upcoming Meetings & All Meetings)
rpm and yum
报告:想学AI的学生数量已涨200%,老师都不够用了
Custom IP used in PCIE
世界第4疯狂的科学家,在103岁生日那天去世了
获取页面数据的方法
leetcode 42. 接雨水
高级驾驶辅助系统ADAS简介
How programmers learn open source projects, this article tells you
Leetcode - 6135: the longest part of the figure
HoloView -- Tabular Datasets
Detailed explanation of JVM runtime data area and JMM memory model