Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

node isfile or isdirectory

const fs = require("fs");

let path = "/path/to/something";

fs.lstat(path, (err, stats) => {

    if(err)
        return console.log(err); //Handle error

    console.log(`Is file: ${stats.isFile()}`);
    console.log(`Is directory: ${stats.isDirectory()}`);
    console.log(`Is symbolic link: ${stats.isSymbolicLink()}`);
    console.log(`Is FIFO: ${stats.isFIFO()}`);
    console.log(`Is socket: ${stats.isSocket()}`);
    console.log(`Is character device: ${stats.isCharacterDevice()}`);
    console.log(`Is block device: ${stats.isBlockDevice()}`);
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery fadein to show modal 
Javascript :: startswith vowels in js 
Javascript :: react media recoder 
Javascript :: javascript submit form programmatically 
Javascript :: ant design charts 
Javascript :: Encoding and Decoding Base64 Strings in Node.js 
Javascript :: hello world react 
Javascript :: select parent of element jquery 
Javascript :: search through json for key 
Javascript :: onclick on fragment react 
Javascript :: javascript uppercase function 
Javascript :: cors blocking communication 
Javascript :: javascript objectentries 
Javascript :: node powershell 
Javascript :: datatable table header not responsive 
Javascript :: delete an element to an array 
Javascript :: how to cut off decimals in javascript 
Javascript :: mongoose bulk create 
Javascript :: updatable time js 
Javascript :: js for of 
Javascript :: react comments 
Javascript :: automatically click button javascript on setinterval 
Javascript :: how to manage logging using winston for production and development in node js "github" 
Javascript :: convert days in years js 
Javascript :: after effects loop wiggle 
Javascript :: setImmediate() nodejs 
Javascript :: { use UnifiedTopology: true } 
Javascript :: canvas tag html 
Javascript :: setinterval vs settimeout 
Javascript :: mongodb aggregate project 
ADD CONTENT
Topic
Content
Source link
Name
8+9 =