Skip to content
No description, website, or topics provided.
TypeScript JavaScript
Branch: master
Clone or download


Type Name Latest commit message Commit time
Failed to load latest commit information.
fixtures initial commit Dec 30, 2015
.gitignore typescript Mar 9, 2019
.npmignore typescript Mar 9, 2019
.travis.yml Correct node version Mar 9, 2019 chore( Add missing license file. May 20, 2018 Update Readme Dec 11, 2018
appveyor.yml use yarn Mar 9, 2019
index.ts typescript Mar 9, 2019
package.json release v2.0.5 🎉 Mar 9, 2019
test.ts typescript Mar 9, 2019
tsconfig.json typescript Mar 9, 2019
yarn.lock Update lockfile Mar 9, 2019


Build Status Build status

This is a utility, which allows a function to figure out from which file it was invoked. It does so by inspecting v8's stack trace at the time it is invoked.

Inspired by

note: this relies on Node/V8 specific APIs, as such other runtimes may not work


yarn add get-caller-file



// ./foo.js
const getCallerFile = require('get-caller-file');

module.exports = function() {
  return getCallerFile(); // figures out who called it
// index.js
const foo = require('./foo');

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


  • getCallerFile(position = 2): where position is stack frame whos fileName we want.
You can’t perform that action at this time.