file-property
get property of file.
introduction
This package will help you get the properties of a file, this package has several functions such as name
, size
, extension
, location
, creationDate
.
installation
before you use this package it must first be installed with:
npm install file-property.
usage
const fp = require("file-property")
// your code goes here...
fast documentation
the following are some of the functions available:
-
fp.name
:taking the name of a file, this function has 2 parameters, namely:
-
filename
: // file name. -
withExtensionOrNo
: // filename with extension? (default true) -
example:
example.js
:// get file name console.log(fp.name("./test.txt")) // get file name (without extension) console.log(fp.name("./test.txt",false))
-
-
fp.size
:taking the size of a file, this function has 2 parameters, namely:
-
filename
: // filename -
megabytesOrBytes
: // megabytes or bytes? default bytes (true) -
example: example.js:
// get file size (in bytes) console.log(fp.size("./test.txt")) // get file size (in megabytes) console.log(fp.size("./test.txt",false))
-
-
fp.extension
:taking the extension of a file, this function has 1 parameters, namely:
-
filename
: // filename -
example:
example.js
:// get file extension console.log(fp.extension("./test.txt"))
-
-
fp.location
:taking the location of a file, this function has 1 parameters, namely:
-
filename
: // filename -
example:
example.js
:// get file location console.log(fp.location("./test.txt"))
-
-
fp.creationDate
:taking the creation date of a file, this function has 1 parameters, namely:
-
filename
: // filename -
example:
example.js
:// get create date of file console.log(fp.creationDate("./test.txt"))
-
conclusion
that's the file-property documentation thank you for reading