Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
@tokenizer/http
Advanced tools
HTTP tokenizer for Node.js and browser
Weekly downloads
Readme
Specialized strtok3 tokenizer for HTTP(S) RFC-7233 range request transfer.
The range request will ensure only the data is downloaded, which is actually being read, and data ignored will not be downloaded.
The range request mechanism is derived from @tokenizer/range.
Install using npm:
npm install @tokenizer/http
or using yarn:
yarn add @tokenizer/http
resolveUrl
, boolean
, default value is true
. Enable caching of redirects of HEAD requests.// const mm = require('music-metadata-browser'); // Use module 'music-metadata-browser' client side
const mm = require('music-metadata'); // Use module 'music-metadata' in Node.js
const {makeTokenizer} = require('@tokenizer/http');
const audioTrackUrl = 'https://test-audio.netlify.com/Various%20Artists%20-%202009%20-%20netBloc%20Vol%2024_%20tiuqottigeloot%20%5BMP3-V2%5D/01%20-%20Diablo%20Swing%20Orchestra%20-%20Heroines.mp3';
(async () => {
const httpTokenizer = await makeTokenizer(audioTrackUrl);
const metadata = await mm.parseFromTokenizer(httpTokenizer);
console.log('metadata:', metadata);
})();
The server needs to send the following headers:
HTTP header- | Value |
---|---|
Access-Control-Allow-Origin | "*" |
Access-Control-Allow-Methods | "GET,HEAD,OPTIONS" |
Access-Control-Allow-Headers | "Content-Type, Range" |
Access-Control-Expose-Headers | "Content-Length, Content-Range" |
Example configuring Apache for streaming. Add the following to .htaccess
in the folder sharing your audio tracks:
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET,HEAD,OPTIONS"
Header set Access-Control-Allow-Headers "Content-Type, User-Agent, If-Modified-Since, Cache-Control, Range"
Header set Access-Control-Expose-Headers "Content-Length, Content-Range"
Ref:
Try if range request is supported:
curl -v -L --header "range: bytes=1-8" http://localhost:8080/bbb/test
(The MIT License)
Copyright (c) 2018 Borewit
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. git pull THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
HTTP tokenizer for Node.js and browser
The npm package @tokenizer/http receives a total of 25 weekly downloads. As such, @tokenizer/http popularity was classified as not popular.
We found that @tokenizer/http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.