Closed aakriti-kedia closed 3 years ago
Any reason you didn't go with my suggestion in https://github.com/sindresorhus/filenamify/issues/13#issuecomment-584898873 ?
Any reason you didn't go with my suggestion in #13 (comment) ?
Hi @sindresorhus My thought process was that if this code is part of filenamify instead of filenamify-path, all the processing related to filename would be dealt in filenamify and abstracted from filenamify-path. As per the logic - If the filename is long, we wish to truncate the filename and not its path - as this is an operation on the filename, it would make sense if it resides in filenamify.
Please feel free to let me know if you have any concerns with extending this approach to filenamify and not keeping it restricted to filenamify-path.
Maybe this could be updated to also account for a few specific "double" extensions such as .tar.gz
and .tar.bz2
?
@papb I don't think it makes sense to handle such extension automatically. That would be surprising behavior. Maybe there could be an option to define a set of known double extensions or something. It's not something I need, so if you need it, open an issue with a proper proposal.
Fixes #13
Excludes the extension, truncates the string to the required length, appends the extension.
Example - Input : very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_long_filename.txt
Output very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_very_veryvery.txt