Giter Site home page Giter Site logo

path-type's Introduction

path-type

Check if a path is a file, directory, or symlink

Install

$ npm install path-type

Usage

import {isFile} from 'path-type';

console.log(await isFile('package.json'));
//=> true

API

isFile(path)

Check whether the passed path is a file.

Returns a Promise<boolean>.

path

Type: string

The path to check.

isDirectory(path)

Check whether the passed path is a directory.

Returns a Promise<boolean>.

isSymlink(path)

Check whether the passed path is a symlink.

Returns a Promise<boolean>.

isFileSync(path)

Synchronously check whether the passed path is a file.

Returns a boolean.

isDirectorySync(path)

Synchronously check whether the passed path is a directory.

Returns a boolean.

isSymlinkSync(path)

Synchronously check whether the passed path is a symlink.

Returns a boolean.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

path-type's People

Contributors

arthurvr avatar bendingbender avatar coreyfarrell avatar kevva avatar lgrammel avatar richienb avatar sindresorhus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

path-type's Issues

v5.0.0 is incompatible with ts-node

I'm hitting a similar issue to TypeStrong/ts-node#155 (comment) with ava and ts-node while importing this in one of the functions I'm testing.

If there's no fix feel free to close this. I figured I couldn't hurt to open and at least others will now be able to find this.

  Uncaught exception in test/app/graphql/resolvers/query/display.ts

  Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/xo/code/unraid/api/node_modules/path-type/index.js
  require() of ES modules is not supported.
  require() of /Users/xo/code/unraid/api/node_modules/path-type/index.js from /Users/xo/code/unraid/api/app/core/modules/info/get-all-devices.ts is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
  Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/xo/code/unraid/api/node_modules/path-type/package.json.


  › Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from node_modules/path-type/package.json.
  › Object.<anonymous> (app/core/modules/info/get-all-devices.ts:4:4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.