/**
* 解析 HTTP Range 请求头
*/
function parseRange(range) {
if (range) {
const matcher = /(?
if (matcher) {
const { groups: { unit, start, end } } = matcher;
return {
unit,
start: Number.parseInt(start),
end: end ? Number.parseInt(end) : undefined
};
}
}
return undefined;
}