Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
range-parser
Advanced tools
Package description
The range-parser package is a utility for parsing HTTP range header fields. It's useful for handling requests for specific ranges of data, which is particularly relevant for serving large files in smaller chunks, such as videos or large documents.
Parse Range Header
This feature allows you to parse the 'Range' header from HTTP requests. It takes the size of the file and the range header as arguments and returns an array of ranges, or an error code if the range is unsatisfiable or syntactically invalid.
const rangeParser = require('range-parser');
const rangeHeader = 'bytes=0-499';
const fileSize = 1000;
const parsedRanges = rangeParser(fileSize, rangeHeader);
The http-range package is similar to range-parser in that it also parses HTTP range headers. However, it provides a more high-level API and includes additional features for creating and manipulating ranges.
The accept-ranges package is designed to parse the Accept-Ranges header in HTTP. While it serves a different purpose from range-parser, it is related in the context of HTTP range requests and responses.
This package is used for parsing multipart range headers, which is a more complex scenario than what range-parser handles. It's useful for multipart downloads and uploads, providing functionality that range-parser does not.
Readme
Range header field parser.
parse(1000, 'bytes=0-499').should.eql([{ start: 0, end: 499 }]);
parse(1000, 'bytes=40-80').should.eql([{ start: 40, end: 80 }]);
parse(1000, 'bytes=-500').should.eql([{ start: 500, end: 999 }]);
parse(1000, 'bytes=-400').should.eql([{ start: 600, end: 999 }]);
parse(1000, 'bytes=500-').should.eql([{ start: 500, end: 999 }]);
parse(1000, 'bytes=400-').should.eql([{ start: 400, end: 999 }]);
parse(1000, 'bytes=0-0').should.eql([{ start: 0, end: 0 }]);
parse(1000, 'bytes=-1').should.eql([{ start: 999, end: 999 }]);
$ npm install range-parser
FAQs
Range header field string parser
We found that range-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.