get-file-details
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published

get-file-details

A Node.js function which gathers basic details about a local file synchronously.

Installation

npm i get-file-details --save

Usage

import getFileDetails from 'get-file-details';

const fileDetails = getFileDetails('path/to/your/file');

File Details

This function queries and returns the most basic essential properties for querying and manipulating files. The naming convention used was inspired by this Stackoverflow answer.

export interface FileDetail {
    /** The file name without an extension */
    fileRoot: string;
    /** The file name including its extension */
    fileName: string;
    /** The file extension including the preceeding dot */
    fileExtension: string;
    /** The directory path, excluding the filename */
    directory: string;
    /** The full path to the file, including the directory, filename, and extension */
    absolutePath: string;
    /** The file's size in megabytes */
    fileSizeInMb: number;
    /** The file's size in bytes */
    fileSizeInBytes: number;
    /** The last modified date represented as the number of milliseconds since the Unix Epoch */
    lastModifiedTimestampInMs: number;
    /** The last modified date represented in simplified ISO 8601 format */
    lastModifiedISODateString: string;
}

Package Sidebar

Install

npm i get-file-details

Weekly Downloads

0

Version

0.0.10

License

MIT

Unpacked Size

11.9 kB

Total Files

15

Last publish

Collaborators

  • pfbrowning