Gathering detailed insights and metrics for filedirname
Gathering detailed insights and metrics for filedirname
npm install filedirname
Typescript
Module System
Min. Node Version
Node Version
NPM Version
83.2
Supply Chain
100
Quality
76.2
Maintenance
100
Vulnerability
100
License
TypeScript (92.3%)
JavaScript (7.7%)
Total Downloads
1,189,829
Last Day
930
Last Week
6,334
Last Month
23,197
Last Year
502,878
16 Stars
62 Commits
3 Forks
3 Watching
1 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
3.4.0
Package Id
filedirname@3.4.0
Unpacked Size
50.24 kB
Size
12.59 kB
File Count
17
NPM Version
10.2.3
Node Version
20.10.0
Publised On
29 Dec 2023
Cumulative downloads
Total Downloads
Last day
-2.7%
930
Compared to previous day
Last week
-2%
6,334
Compared to previous week
Last month
1%
23,197
Compared to previous month
Last year
19%
502,878
Compared to previous year
Fetch the current file and directory path, no matter your environment (Deno, Node.js, Web Browsers, ESM, CJS)
The following works for ESM (ECMAScript Modules) and CJS (CommonJS Modules) enviroments:
1// for deno 2import filedirname from 'https://unpkg.com/filedirname/edition-deno/index.ts' 3// for web browsers 4import filedirname from 'https://unpkg.com/filedirname' 5// for node.js 6import filedirname from 'filedirname' 7// for commonjs 8const filedirname = require('filedirname').default 9 10// usage 11const [file, dir] = filedirname() 12console.log({ file, dir })
The following works for ESM (ECMAScript Modules) and CJS (CommonJS Modules) environments:
1// for deno 2import filedirname from 'https://unpkg.com/filedirname/edition-deno/index.ts' 3// for web browsers 4import filedirname from 'https://unpkg.com/filedirname' 5// for node.js 6import filedirname from 'filedirname' 7// for commonjs 8const filedirname = require('filedirname').default 9 10// usage 11const [file, dir] = filedirname(new Error()) 12console.log({ file, dir })
import.meta.url
The following works only for ESM (ECMAScript Modules) environments and is the quickest solution:
1// for deno 2import filedirname from 'https://unpkg.com/filedirname/edition-deno/index.ts' 3// for web browsers 4import filedirname from 'https://unpkg.com/filedirname' 5// for node.js 6import filedirname from 'filedirname' 7 8// usage 9const [file, dir] = filedirname(import.meta.url) 10console.log({ file, dir })
npm install --save filedirname
import pkg from ('filedirname')
const pkg = require('filedirname').default
1import pkg from 'https://unpkg.com/filedirname@^3.4.0/edition-deno/index.ts'
This package is published with the following editions:
filedirname
aliases filedirname/index.cjs
which uses the Editions Autoloader to automatically select the correct edition for the consumer's environmentfiledirname/source/index.ts
is TypeScript source code with Import for modulesfiledirname/edition-es2022/index.js
is TypeScript compiled against ES2022 for Node.js 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modulesfiledirname/edition-es5/index.js
is TypeScript compiled against ES5 for Node.js 4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modulesfiledirname/edition-es2022-esm/index.js
is TypeScript compiled against ES2022 for Node.js 12 || 14 || 16 || 18 || 20 || 21 with Import for modulesfiledirname/edition-types/index.d.ts
is TypeScript compiled Types with Import for modulesfiledirname/edition-deno/index.ts
is TypeScript source code made to be compatible with DenoDiscover the release history by heading on over to the HISTORY.md
file.
Discover how to contribute via the CONTRIBUTING.md
file.
Unless stated otherwise all works are:
and licensed under:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
2 existing vulnerabilities detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 4
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/15 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More