12345678910111213141516171819202122232425262728 |
- export const buildDir = () => {
-
- const date = new Date()
- const dir = date.getFullYear() + '/' + (date.getMonth() + 1) + '/' + date.getDate()
- function rx() {
- return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1)
- }
- return `${dir}/${date.getTime()}-${rx()}${rx()}`
- }
- export const buildName = (name) => {
- const index = name.lastIndexOf('.') + 1
- const format = name.substring(
- index,
- name.length
- )
- return buildDir() + '.' + format
- }
|