If there any API could retrieve file name from an absolute file path?
e.g. "foo.txt"
from "/var/www/foo.txt"
I know it works with string operation, like fullpath.replace(/.+//, '')
but I want to know is there a more 'formal' way, like file.getName()
in java, could do it.
NodeJS get file name from absolute path?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…