FileUtils.ts 366 B

123456789101112131415161718
  1. const getFileName = (url: string): string => {
  2. if (url) {
  3. const index = url.lastIndexOf('/')
  4. return url.substring(index + 1)
  5. } else {
  6. return ''
  7. }
  8. }
  9. const getFileType = (url: string): string => {
  10. if (url) {
  11. const index = url.lastIndexOf('.')
  12. return url.substring(index + 1)
  13. } else {
  14. return ''
  15. }
  16. }
  17. export {getFileName,getFileType}