Node.js get file extension

后端 未结 13 887
后悔当初
后悔当初 2020-12-23 00:16

Im creating a file upload function in node.js with express 3.

I would like to grab the file extension of the image. so i can rename the file and then append the file

相关标签:
13条回答
  • 2020-12-23 00:53

    import extname in order to return the extension the file:

    import { extname } from 'path';
    extname(file.originalname);
    

    where file is the file 'name' of form

    0 讨论(0)
提交回复
热议问题