Express4中文文档
Range
标头解析器。
size
参数是资源的最大大小。
options
参数是一个可以具有以下属性的对象。
属性 | 类型 | 描述 |
---|---|---|
combine | 布尔值 | 指定是否应合并重叠和相邻范围,默认为 false 。当 true 时,范围将被组合并返回,就好像它们在标题中以这种方式指定一样。 |
将返回一个范围数组或指示解析错误的负数。
-2
表示格式错误的标头字符串-1
表示无法满足的范围// parse header from request
var range = req.range(1000)
// the type of the range
if (range.type === 'bytes') {
// the ranges
range.forEach(function (r) {
// do something with r.start and r.end
})
}