0.1.8 • Published 1 year ago

@rae004/get-file-paths v0.1.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Get File Paths

npm Package GitHub license node

Install

npm

npm i @rae004/get-file-paths

yarn

yarn add @rae004/get-file-paths

Basic Usage

Get All files in directory with default options

import { getFilePaths } from '@rae004/get-file-paths';

const paths = await getFilePaths('./')

output:

[
  {
    fullPath: '/Users/daUser/projects/get-file-paths/package.json',
    relativePath: 'Users/daUser/projects/get-file-paths/package.json',
    fileName: 'package.json'
  }
  // ...Other File objects
]

Get All files with a relative root of projects

don't include relative root in relativePath

import { getFilePaths } from '@rae004/get-file-paths';

const paths = await getFilePaths('./', {
    relativeRoot: 'projects', 
    includeRelativeRoot: false 
})

output:

[
  {
    fullPath: '/Users/rae004/projects/get-file-paths/package.json',
    relativePath: 'get-file-paths/package.json',
    fileName: 'package.json'
  }
]

include relative root in relativePath

import { getFilePaths } from '@rae004/get-file-paths';

const paths = await getFilePaths('./', {
    relativeRoot: 'projects', 
    includeRelativeRoot: true 
})

output:

[
  {
    fullPath: '/Users/rae004/projects/get-file-paths/package.json',
    relativePath: 'get-file-paths/package.json',
    fileName: 'package.json'
  }
]
0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.0

1 year ago

0.0.7

1 year ago

0.0.4

1 year ago