Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to read file extension in a folder in node js

fs.readdir('./', (err, files) => {
        files.forEach(file => {
        //   console.log(file);
         // read extension
          const extension = file.split(".").pop();
          });
      })
Comment

get file extension node

var path = require('path')

path.extname('index.html')
// returns
'.html'
Comment

get file extension nodejs

const path = require('path');

path.extname('index.html');
// Returns: '.html'

path.extname('index.coffee.md');
// Returns: '.md'

path.extname('index.');
// Returns: '.'

path.extname('index');
// Returns: ''

path.extname('.index');
// Returns: ''

path.extname('.index.md');
// Returns: '.md'
Comment

PREVIOUS NEXT
Code Example
Javascript :: vaidate youtube url 
Javascript :: how to set background colour i js inline stylel 
Javascript :: output in javascript 
Javascript :: angular filter ngfor 
Javascript :: Fibonacci Series Program. in javascript 
Javascript :: how to stop browser back js 
Javascript :: react native import svg image 
Javascript :: While loop factorial function in javascript 
Javascript :: decode morse code js 
Javascript :: select2 clear fields 
Javascript :: react native copy to clipboard 
Javascript :: how to find length of array in javascript without using length method 
Javascript :: javascript string contains 
Javascript :: access variable outside for loop javascript 
Javascript :: svg to string javascript 
Javascript :: number of repetition in an array javascript 
Javascript :: upload multiple images cloudinary 
Javascript :: chrome add a bookmark that appends to current url 
Javascript :: javascript text new line 
Javascript :: css lint 
Javascript :: jquery remove option from select 
Javascript :: javascript run command 
Javascript :: add active class to li onclick react 
Javascript :: remove node modules command windows 
Javascript :: js remove the last character from a string 
Javascript :: discord.js send message to a given channel 
Javascript :: javascript last character 
Javascript :: js get max value in an array 
Javascript :: javascript array to table 
Javascript :: nodejs csv to json from link 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =