Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 25, 2024 via pnpm

get-caller-file 2.0.5

[![Build Status](https://travis-ci.org/stefanpenner/get-caller-file.svg?branch=master)](https://travis-ci.org/stefanpenner/get-caller-file) [![Build status](https://ci.appveyor.com/api/projects/status/ol2q94g1932cy14a/branch/master?svg=true)](https://ci.a
Package summary
Share
0
issues
1
license
1
ISC
Package created
30 Dec 2015
Version published
9 Mar 2019
Maintainers
1
Total deps
1
Direct deps
0
License
ISC

Issues

0
This package has no issues

Licenses

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
get-caller-file@2.0.5
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of get-caller-file 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does get-caller-file do?

The "get-caller-file" is an essential utility in JavaScript, specifically designed to discern from which file a function has been invoked. This is made possible by examining V8's stack trace at the moment the function is activated. This utility is profoundly inspired by Node/V8 particular APIs and may not function properly on different platforms.

How do you use get-caller-file?

The "get-caller-file" package is simple to use and can be incorporated into your JavaScript code effectively. You initially need to install it using Yarn by running yarn add get-caller-file in your terminal. Once installed, you can then require the 'get-caller-file' in your script. As an example, in ./foo.js, you'd write:

const getCallerFile = require('get-caller-file');

module.exports = function() {
  return getCallerFile(); // figures out who called it
};

Then in index.js, you can call the function exported from ./foo.js:

const foo = require('./foo');

foo() // => /full/path/to/this/file/index.js

The output of foo() will be the absolute path to the calling file, in this case, index.js.

You can also pass a position argument to getCallerFile() to specify the stack frame whose file name you want.

Where are the get-caller-file docs?

The documentation for the "get-caller-file" package can be found directly on its GitHub repository: https://github.com/stefanpenner/get-caller-file. The README on this page provides a detailed explanation of the utility's functionality and usage.