ocket8888 commented on code in PR #7375: URL: https://github.com/apache/trafficcontrol/pull/7375#discussion_r1145272008
########## experimental/traffic-portal/src/app/shared/file-utils.service.ts: ########## @@ -0,0 +1,147 @@ +/** + * @license Apache-2.0 + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Inject, Injectable } from "@angular/core"; + +import { isArrayBufferView } from "../utils"; + +/** + * FileUtilsService provides utilities dealing with files, uploads, downloads, + * etc. + */ +@Injectable() +export class FileUtilsService { + + /** The default MIME-Type for string data downloads. */ + public static readonly TEXT_CONTENT_TYPE = "text/plain;charset=UTF-8"; + /** The default MIME-Type for raw binary data downloads. */ + public static readonly BINARY_DATA_CONTENT_TYPE = "application/octet-stream"; + /** The default MIME-Type for arbitrary object downloads. */ + public static readonly JSON_DATA_CONTENT_TYPE = "application/json"; + + /** + * The file name that will be used for downloads, if one is not provided. + */ + public static readonly DEFAULT_FILE_NAME = "download"; + + /** A pre-compiled expression that matches a '.' at the start of a string */ + private static readonly EXT_PATTERN = /^\./; + + constructor(@Inject("Window") private readonly window: Window) { } Review Comment: hm, I didn't even consider SSR limitations, since it's a lazy-loaded module. Regardless, fixed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@trafficcontrol.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org