1.0.15 • Published 2 years ago

pkg-file-resolver v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

pkg-file-resolver

Easily fix the shortcomings of referencing files locally to your pkg'd executable

Use

First install the pkg-file-resolver using the npm command line tool

npm i -g pkg-file-resolver

Then, to use it in your code require it as follows:

const { __resolve } = require("pkg-file-resolver")

console.log(__resolve)

Goal

Within the pkg system the files that are compiled are adding into a snapshot system where they run like they're in a separate drive. This complicates things when you try to reference files local to the exe, as the node program thinks it's in an entirely different drive.
| | node | pkg | |-----------------------|--------------------|-----------------------| | filename | /dir/file.js | /snapshot/dir/file.js | | dirname | /dir | /snapshot/dir | | process.cwd() | /dir as of the cmd | /Users/user | | process.execPath | /node.exe | /dir/file.exe | | process.argv0 | /node.exe | /dir/file.exe | | process.argv1 | /dir/file.js | /snapshot/dir/file.js | | require.main.filename | /dir/file.js | /snapshot/dir/file.js | | __resolve | /dir | /dir |

pkg-file-resolver stands to help jump over this obstacle of just getting the local directory

1.0.9

2 years ago

1.0.8

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago