Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hlx-url-rewriter

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hlx-url-rewriter - npm Package Compare versions

Comparing version 0.0.15 to 0.0.16

25

default.js

@@ -64,8 +64,2 @@ const path = require('path');

function relativePath(from, to) {
const fromDir = path.dirname(from);
print(`\trelativePath: from="${fromDir}", to="${to}"`);
return path.relative(fromDir, to);
}
function rewrite(uri, base) {

@@ -84,11 +78,14 @@ const {rootPath = '/'} = defaultFunc.options;

let result;
if (playlistUrl && url.protocol === playlistUrl.protocol && url.hostname === playlistUrl.hostname) {
print('\tpattern-a');
result = relativePath(playlistUrl.pathname, url.pathname);
} else if (playlistUrl && playlistUrl.protocol === 'file:') {
print('\tpattern-b');
result = relativePath(playlistUrl.pathname, path.join(rootPath, url.hostname, url.pathname));
if (!playlistUrl) {
print('\tpattern-A');
result = path.relative(url.protocol === 'file:' ? rootPath : '/', url.pathname);
} else if (url.protocol === playlistUrl.protocol && url.hostname === playlistUrl.hostname) {
print('\tpattern-B');
result = path.relative(path.dirname(playlistUrl.pathname), url.pathname);
} else if (playlistUrl.protocol === 'file:') {
print('\tpattern-C');
result = path.relative(path.dirname(playlistUrl.pathname), path.join(rootPath, url.hostname, url.pathname));
} else {
print('\tpattern-c');
result = `/${url.hostname}${url.pathname}`;
print('\tpattern-D');
result = path.join('/', url.hostname, url.pathname);
}

@@ -95,0 +92,0 @@ print(`\t>>> "${result}"`);

{
"name": "hlx-url-rewriter",
"version": "0.0.15",
"version": "0.0.16",
"description": "A transform stream to modify URLs contained in HLS playlists",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc