1.0.15 • Published 3 years ago

pkg-file-resolver v1.0.15

Weekly downloads
-
License
ISC
Repository
github
Last release
3 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

3 years ago

1.0.8

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago