hlx-file-writer
Advanced tools
Comparing version 0.0.5 to 0.0.6
13
file.js
const fs = require('fs'); | ||
const path = require('path'); | ||
const {getPath} = require('./util'); | ||
const {tryCatch} = require('hlx-util'); | ||
@@ -17,6 +17,11 @@ function storeData({uri, data}, rootPath) { | ||
if (path.isAbsolute(uri) && fs.existsSync(uri)) { | ||
localPath = path.join(rootPath, path.basename(uri)); | ||
if (path.isAbsolute(uri)) { | ||
localPath = path.join(rootPath, path.relative(rootPath, uri)); | ||
} else { | ||
localPath = path.join(rootPath, getPath(uri)); | ||
const obj = tryCatch( | ||
() => new URL(uri), | ||
() => new URL(uri, rootPath), | ||
() => null | ||
); | ||
localPath = path.join(rootPath, obj ? obj.pathname : uri); | ||
} | ||
@@ -23,0 +28,0 @@ |
{ | ||
"name": "hlx-file-writer", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "A writable stream to save HLS playlists/segments as local files", | ||
@@ -53,3 +53,4 @@ "main": "index.js", | ||
"debug": "^4.1.1", | ||
"hls-parser": "^0.4.3" | ||
"hls-parser": "^0.4.4", | ||
"hlx-util": "0.0.2" | ||
}, | ||
@@ -56,0 +57,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6932
3
5
92
+ Addedhlx-util@0.0.2
+ Addedhlx-util@0.0.2(transitive)
Updatedhls-parser@^0.4.4