How to use the extname function from path
Find comprehensive JavaScript path.extname code examples handpicked from public code repositorys.
247 248 249 250 251 252 253 254 255 256const destinationFile = path.join( destinationFolder, extraPath, prefix + (destinationFileBase ? destinationFileBase + path.extname(sourceFile) : path.basename(sourceFile)) ); // Copy from the source to the destination. const sourceContents = fs.readFileSync(sourceFile, { encoding: 'utf-8' });
+ 2 other calls in file
GitHub: dependents/node-precinct
138 139 140 141 142 143 144 145 146 147 148 149precinct.paperwork = (filename, options = {}) => { options = { includeCore: true, ...options }; const fileSystem = options.fileSystem || fs; const content = fileSystem.readFileSync(filename, 'utf8'); const ext = path.extname(filename); let type; if (ext === '.styl') { debug('paperwork: converting .styl into the stylus type');
761 762 763 764 765 766 767 768 769 770'url': `${settings.baseUrl}${m[1]}`, }; }), null, 2); for (const fileName of files) { const ext = path.extname(fileName); if (!byFilename[path.basename(fileName)]) { if (!hackyProcessSelectFiles) { throw new Error(`${fileName} is not in toc.hanson`); }
+ 5 other calls in file
52 53 54 55 56 57 58 59 60 61if (err) { console.log("Final Step err:", err); return reject(err); } const filename = buf.toString("hex") + path.extname(file.originalname); const fileInfo = { filename: filename, bucketName: "attachments", };
+ 3 other calls in file
49 50 51 52 53 54 55 56 57 58) { FS.unlinkSync( `${__dirname}/Public/PostsImages/${req.body?.PREVIEWCODE}${req.body?.PREVIEWEXT}` ); } const uniqueSuffix = ImageCode + Path.extname(file.originalname); cb(null, uniqueSuffix); } else { let Model = new mongoose.model("users", UserSchema); let Result = await Model.find({ _id: req.body.ID });
+ 9 other calls in file
929 930 931 932 933 934 935 936 937response.send({error: true}); return; } // filter for JSON files const jsonFiles = files.filter(file => path.extname(file) === '.jsonl'); // sort the files by name //jsonFiles.sort().reverse();
GitHub: mchan004/CookingA-Z
12167 12168 12169 12170 12171 12172 12173 12174 12175 12176// image if (image = options.image) { switch(cmd.type) { case 'Darwin-Growl': var flag, ext = path.extname(image).substr(1) flag = flag || ext == 'icns' && 'iconpath' flag = flag || /^[A-Z]/.test(image) && 'appIcon' flag = flag || /^png|gif|jpe?g$/.test(ext) && 'image' flag = flag || ext && (image = ext) && 'icon'
+ 5 other calls in file
GitHub: Soulaimane07/MTDB-Server
7 8 9 10 11 12 13 14 15 16const storage = multer.diskStorage({ destination: function(req, file, cb){ cb(null, 'uploads/images/users/') }, filename: function(req, file, cb){ cb(null, Date.now() + path.extname(file.originalname)) } }) const upload = multer({ storage: storage,
13 14 15 16 17 18 19 20 21 22 23folder = "pets"; } cb(null, `public/images/${folder}/`); }, filename: (req, file, cb) => { cb(null, Date.now() + path.extname(file.originalname)); }, }); const imageUpload = multer({
GitHub: Karensaf/Multer
4 5 6 7 8 9 10 11 12 13 14 15//* Crear el storage engine const storage = multer.diskStorage({ destination: './public/uploads/', filename: function (req, file, cb) { cb(null, file.fieldname + "-" + Date.now()+ path.extname(file.originalname)) } }) //* Inicializanco a upload