D
Deno

help

How to get the path to the compiled binary?

QQuantum12/18/2023
import.meta.url and Deno.mainModule are used to get the current script, but after a binary is created, those get frozen to the script at the time that the compile was performed. Moving the binary somewhere else gives you the same (now wrong) result when import.meta.url or Deno.mainModule get called.
IioB12/18/2023
what's the usecase by the way?
Ssyhol12/18/2023
One option is to get the pid from Deno.pid then using that to lookup the path to the executable https://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux it's messy though as you might need to handle each OS differently
Stack Overflow
How do I get the path of a process in Unix / Linux?
In a Windows environment there is an API to obtain the path which is running a process. Is there something similar in Unix / Linux? Or is there some other way to do that in these environments?
QQuantum12/18/2023
The use case woud be, run the binary and the binary looks for a settings.json file right next to it or looks inside of /data folder for sqlite files, etc. off the relative path seems like something that should be doable for any binary
IioB12/18/2023
the easiest thing would probably be to spawn some programs depending on OS and do some console nonsense
QQuantum12/18/2023
quite possibly. let me take a look at what Syhol suggested
LLeokuma12/29/2023
Deno.execPath()
Deno.execPath()
IioB12/29/2023
^^^ the correct answer

Looking for more? Join the community!

Recommended Posts
How to get `require.main.filename` like Node as DenoI am making a module to be published on deno.land/x. I want the user to put a file describing the coChange Web Worker Permissions after the Worker StartedHello, I was wondering if it is possible to change/update the permissions of a web worker after it Missing transpiled source codeI'm trying to generate coverage for my project and I'm getting the following: ``` deno task coverageTrouble validating a requestHi there! I'm trying to validate a Discord HTTP request, but I don't know how to do it (https://discHow to deploy to Deno Deploy from a Github repository's subdirectory?I read somewhere that you can deploy from a subdirectory, but I can't find any documentation on how Convert to exeI have made my Javascript program into an exe with deno: https://docs.deno.com/runtime/manual/tools/Manual deployment promotion + long lived preview deploymentsHello! I am working on a deployment pipeline and have a few questions: 1. Is there a way to promoteIs there a way to get deno coverage information in a vscode lens?If I run my tests with coverage enabled, can I get some visual feedback in vscode?Performance QuestionI have a Deno application, which creates API endpoint, and uses mongodb. Now I want to host this on Is there a way to get a server's SSL certificate's public information with Deno?This is available in Node with `getPeerCertificate()` but not in Deno's Node compatibility layer - iInvalidData: No certificates found in cert fileHello! Following up from a previous help post here, https://discord.com/channels/684898665143206084/Cannot use deno prompt when in windows CMDIt only works in the VSCode integrated terminal? I have added some output around the run command, buStreaming large files with fetch and FormDataHi, I'm trying to find a way to build multiplart/form-data requests in Deno that contain large filesIf I want to integrate a fully featured Deno runtime into my application, where do I start?I want to create a scripting environment for my application that will enable people to create customTrying to deploy a project on Deno Deploy with a private Github repository dependencyBy reading the docs at https://docs.deno.com/runtime/manual/basics/modules/private I found that I caHow can I make sure the code gets run on the client-side??!```tsx import { useEffect, useState } from "preact/hooks"; export default function Callback() { VSCode + Deno + Vite + TypescriptJust setup a project with `create-vite-extra` but all the starter files are full of typescript errorMemory LimitHello guys, in some situations i'am receiving one of the following error message `dd-hard-memory-limGoogle CalendarHi! I am looking for a minimal example how to access google calendar API. I already obtained credenI can't access my deno cloud github accountPlease help, by mistake I converted my personal github account to an organization account, and now I