getUrlExtension

获取 URL 的文件扩展名

用法

getUrlExtension 函数用于获取 URL 的文件扩展名。

import { getUrlExtension } from '@movk/core'

getUrlExtension('https://example.com/file.pdf') // 'pdf'
getUrlExtension('https://example.com/file.tar.gz') // 'gz'
getUrlExtension('https://example.com/path/') // ''

API

getUrlExtension(url)

获取 URL 的文件扩展名。

参数

url
string required
URL 字符串。

返回值

返回值
string
文件扩展名(不含点),无扩展名返回空字符串。

Changelog

b6146 — refactor: 统一源码文件命名为 camelCase

7c832 — refactor!: 重构模块架构,拆分 utils 为专业化模块

Copyright © 2024 - 2026 YiXuan - MIT License