Coder Social home page Coder Social logo

Comments (2)

forJrking avatar forJrking commented on May 27, 2024

源代码:

 //组合一个名字给输出文件
            val cacheFile = "$mOutPutDir/${System.nanoTime()}.${type.suffix}"
            //重命名接口
            val outFile = if (mRenamePredicate != null) {
                File(mRenamePredicate!!.invoke(cacheFile))
            } else {
                File(cacheFile)
            }

而且有了 setOutPutDir 设置输出目录
rename这里应该就是只修改文件名

另:
我觉得压缩后文件名应该使用原文件名,这样比较合理;
上传后展示上传的文件名,用时间戳是区分不出来哪个对哪个的。

rename 只修改文件名,这个建议可以考虑修改下,使用原文件名有个问题就是如果原来文件不同目录同名问题

from kluban.

DuShuYuan avatar DuShuYuan commented on May 27, 2024

源代码:

 //组合一个名字给输出文件
            val cacheFile = "$mOutPutDir/${System.nanoTime()}.${type.suffix}"
            //重命名接口
            val outFile = if (mRenamePredicate != null) {
                File(mRenamePredicate!!.invoke(cacheFile))
            } else {
                File(cacheFile)
            }

而且有了 setOutPutDir 设置输出目录
rename这里应该就是只修改文件名
另:
我觉得压缩后文件名应该使用原文件名,这样比较合理;
上传后展示上传的文件名,用时间戳是区分不出来哪个对哪个的。

rename 只修改文件名,这个建议可以考虑修改下,使用原文件名有个问题就是如果原来文件不同目录同名问题

那得是多文件批量压缩时有可能出现这种情况,单文件压缩没影响。

可以这样解决:

已经有提供修改文件名和输出路径的方法了,使用者可以灵活配置;
也可以保留使用时间戳的命名方式,给个配置方法来修改就行,有点和rename重复
或者压缩或保存时先检测原文件名存不存在,不存在就使用原文件名,存在的话就使用其他命名方式,比如:时间戳 或 windows的 原文件名+序号

from kluban.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.