Now with more download and copy link options.

This commit is contained in:
Scott Idem
2024-10-18 15:51:52 -04:00
parent 488031f90c
commit 5da209ee1c
7 changed files with 228 additions and 43 deletions

View File

@@ -1,5 +1,19 @@
// These are all file related functions.
// Use a defined list of unacceptable characters to remove from a filename.
// Updated 2024-10-18
export let clean_filename = function clean_filename(filename: any|string, unacceptable_chars: RegExp = /[ <>:"/\\|?*]/g, replacement_char: string = '_') {
// console.log('*** clean_filename() ***');
if (!filename) {
return '';
}
let cleaned_filename = filename.replace(unacceptable_chars, replacement_char);
// console.log(cleaned_filename);
return cleaned_filename;
}
export let format_bytes = function format_bytes(
bytes: number,
decimals: number = 2