"use strict"; const path = require("path"); const mime = require("mime-types"); const parseRange = require("range-parser"); const getFilenameFromUrl = require("./utils/getFilenameFromUrl"); const { getHeaderNames, getHeaderFromRequest, getHeaderFromResponse, setHeaderForResponse, setStatusCode, send, sendError } = require("./utils/compatibleAPI"); const ready = require("./utils/ready"); /** @typedef {import("./index.js").NextFunction} NextFunction */ /** @typedef {import("./index.js").IncomingMessage} IncomingMessage */ /** @typedef {import("./index.js").ServerResponse} ServerResponse */ /** * @param {string} type * @param {number} size * @param {import("range-parser").Range} [range] * @returns {string} */ function getValueContentRangeHeader(type, size, range) { return `${type} ${range ? `${range.start}-${range.end}` : "*"}/${size}`; } /** * @param {string | number} title * @param {string} body * @returns {string} */ function createHtmlDocument(title, body) { return `${"\n" + '
\n' + "\n" + '\n' + "\n` + `\n` + `
\n` + `

    ${body}

\n` + `
\n` + `