getUrlFilename

获取 URL 的文件名

用法

getUrlFilename 函数用于获取 URL 的文件名。

import { getUrlFilename } from '@movk/core'

getUrlFilename('https://example.com/path/file.pdf') // 'file.pdf'
getUrlFilename('https://example.com/path/file.pdf', false) // 'file'
getUrlFilename('https://example.com/path/') // ''

API

getUrlFilename(url, includeExtension?)

获取 URL 的文件名。

参数

url
string required
URL 字符串。
includeExtension
boolean
是否包含扩展名,默认 true

返回值

返回值
string
文件名。

Changelog

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

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

Copyright © 2024 - 2026 YiXuan - MIT License