文件操作 - parseProxyUrl.js.flow
返回文件管理
返回主菜单
删除本文件
文件: /node_modules/global-agent/dist/utilities/parseProxyUrl.js.flow
编辑文件内容
// @flow import { parse as parseUrl, } from 'url'; import { UnexpectedStateError, } from '../errors'; export default (url: string) => { const urlTokens = parseUrl(url); if (urlTokens.query !== null) { throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have query.'); } if (urlTokens.hash !== null) { throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL must not have hash.'); } if (urlTokens.protocol !== 'http:') { throw new UnexpectedStateError('Unsupported `GLOBAL_AGENT.HTTP_PROXY` configuration value: URL protocol must be "http:".'); } let port = 80; if (urlTokens.port) { port = Number.parseInt(urlTokens.port, 10); } return { authorization: urlTokens.auth || null, hostname: urlTokens.hostname, port, }; };
修改文件时间
将文件时间修改为当前时间的前一年
删除文件