Can I use the HTTP range header to load partial files quot;on purposequot;?(我可以使用 HTTP 范围标头“故意加载部分文件吗?)
问题描述
我正在使用 HTTP 范围标头(规范).
I'm playing around with the HTTP range header (specs).
据我了解,我可以设置文件的字节范围 ala
From what I understand I can set byte ranges of files ala
0-199/2000
200-499/2000
500-799/2000
etc
问题:
假设我只想访问文件的某些范围,是否可以指定这些范围,然后使用我收到的不完整"数据?我正在过滤一个大的日志文件,所以我很好奇这样的事情是否可行.
Question:
Say I only want to access certain ranges of a file, would it be possible to specify these ranges and then work with the "incomplete" data I received? I'm playing around with filtering a large log file, so I'm curious if something like this would work.
感谢您的意见!
推荐答案
你是对的,你在评论中发布的链接可能是最好的方法.因为你的问题听起来很有趣,所以我试了一下.你可能做到了,但这里有一个片段(可能会看到其他片段)
You are right the link which you posted in the comment would be probably the best approche. As your question sounded interesting i tried it out. You probably did it, but here is an snippet(for other that may come looking)
var xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET","data.dat",false);
xmlhttp.setRequestHeader("Range", "bytes=100-200");
xmlhttp.send();
console.info(xmlhttp); //--> returns only the partial content
// Tested on Win7 with chrome 46+
这篇关于我可以使用 HTTP 范围标头“故意"加载部分文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我可以使用 HTTP 范围标头“故意"加载部分文件吗?
基础教程推荐
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
