file-property

1.0.0 • Public • Published

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:

  1. fp.name:

    taking the name of a file, this function has 2 parameters, namely:

    1. filename: // file name.

    2. withExtensionOrNo: // filename with extension? (default true)

    3. example: example.js:

      // get file name
      console.log(fp.name("./test.txt"))
      
      // get file name (without extension)
      console.log(fp.name("./test.txt",false))

  2. fp.size:

    taking the size of a file, this function has 2 parameters, namely:

    1. filename: // filename

    2. megabytesOrBytes: // megabytes or bytes? default bytes (true)

    3. 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))

  3. fp.extension:

    taking the extension of a file, this function has 1 parameters, namely:

    1. filename: // filename

    2. example: example.js:

      // get file extension 
      console.log(fp.extension("./test.txt"))

  4. fp.location:

    taking the location of a file, this function has 1 parameters, namely:

    1. filename: // filename

    2. example: example.js:

      // get file location 
      console.log(fp.location("./test.txt"))

  5. fp.creationDate:

    taking the creation date of a file, this function has 1 parameters, namely:

    1. filename: // filename

    2. 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

Readme

Keywords

Package Sidebar

Install

npm i file-property

Weekly Downloads

2

Version

1.0.0

License

ISC

Unpacked Size

5.88 kB

Total Files

5

Last publish

Collaborators

  • pashaerlangga