Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F10360559
build_html.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
build_html.js
View Options
import
{
readFileSync
}
from
"fs"
;
/**
* @param {string | undefined} har_file
* @param {[string, string][] | undefined} private_data
*/
export
function
build_html
(
har_file
,
private_data
)
{
let
path_prefix
=
import
.
meta
.
dirname
+
"/"
;
let
template
=
readFileSync
(
path_prefix
+
"src/template.html"
).
toString
(
'utf8'
);
let
replacement
=
""
;
replacement
+=
"<script type='module'>"
+
readFileSync
(
path_prefix
+
"lib/src/web_entrypoint.js"
).
toString
(
'utf8'
)
+
'</script>'
;
if
(
har_file
)
{
replacement
+=
"<script id='har_file' type='application/json'>"
+
har_file
+
'</script>'
;
}
template
=
template
.
replace
(
'<!-- REPLACE ME -->'
,
replacement
);
if
(
private_data
)
{
let
replacement
=
""
;
for
(
const
row
of
private_data
)
{
replacement
+=
"<tr>\n"
replacement
+=
" <td>"
replacement
+=
row
[
0
];
replacement
+=
" </td>\n"
replacement
+=
" <td>"
replacement
+=
row
[
1
];
replacement
+=
" </td>\n"
replacement
+=
"</tr>\n"
}
template
=
template
.
replace
(
"<!-- PRIVATE INFO -->"
,
replacement
);
}
return
template
;
}
File Metadata
Details
Attached
Mime Type
text/html
Expires
Sat, Nov 8, 07:18 (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1034278
Default Alt Text
build_html.js (1 KB)
Attached To
Mode
R171 har-analyzer
Attached
Detach File
Event Timeline
Log In to Comment