javi
javi
DDeno
Created by Quantum on 1/28/2024 in #help
Hoping for a clean way to get an array of filenames in directory
You can use <Array>.fromAsync
const result = (await Array.fromAsync(Deno.readDir(Deno.cwd()))).filter(({ isFile }) => isFile);
const result = (await Array.fromAsync(Deno.readDir(Deno.cwd()))).filter(({ isFile }) => isFile);
Or go over the board with fp-ts, which is way more readable
import { task, function as func } from "npm:fp-ts"

const result = await func.pipe(
Deno.cwd(),
Deno.readDir,
Array.fromAsync,
task.of,
task.map((files) => files.filter(({ isFile }) => isFile)),
(fn) => fn()
)
import { task, function as func } from "npm:fp-ts"

const result = await func.pipe(
Deno.cwd(),
Deno.readDir,
Array.fromAsync,
task.of,
task.map((files) => files.filter(({ isFile }) => isFile)),
(fn) => fn()
)
7 replies
DDeno
Created by pyzaist on 12/22/2023 in #help
Deno, TypeScript, ESBuild, WebGL, VSCode
You cannot do imports like that. The reason for which you do the declare module … is because under the hood, a bundler like webpack or rollup is used. Deno doesn't have those. One alternative is to just use Deno.readFile and the like
30 replies
DDeno
Created by kitty on 11/3/2023 in #help
Is there any way to run deno as a cluster on one machine? (like pm2)
Create an ecosystem.config.js file and add the following contents:
// change for your values
module.exports = {
apps: [
{
name: "name",
script: "/path/to/source.ts",
interpreter: "/home/user/.deno/bin/deno",
interpreterArgs: "run -A --unstable",
},
],
};
// change for your values
module.exports = {
apps: [
{
name: "name",
script: "/path/to/source.ts",
interpreter: "/home/user/.deno/bin/deno",
interpreterArgs: "run -A --unstable",
},
],
};
Then run
npx pm2 start ecosystem.config.js
npx pm2 start ecosystem.config.js
4 replies
DDeno
Created by wedman on 10/9/2023 in #help
Preact hooks doesn't get executed!
youre welcome!
15 replies
DDeno
Created by wedman on 10/9/2023 in #help
Preact hooks doesn't get executed!
this and this for reference
15 replies
DDeno
Created by wedman on 10/9/2023 in #help
Preact hooks doesn't get executed!
you cant use Deno.* there. Either a call to an api in the routes/api/ folder, or a handler in that route
15 replies
DDeno
Created by shultz on 10/2/2023 in #help
typescript type definition for deno.json
You can get the json schema, which is basically the same here
4 replies
DDeno
Created by Aziz on 9/29/2023 in #help
Inquiry Regarding Deno Security Model and Command Injection Vulnerability
Well yes and no. If the user controls the command executed, yes. It’s the same as —allow-ffi. If you grant that, FFI can be used, essentially overcoming all sandbox features
7 replies
DDeno
Created by Aziz on 9/29/2023 in #help
Inquiry Regarding Deno Security Model and Command Injection Vulnerability
You should also sanitize the user input, interpolating a script and executing whatever was fed into is not the way to go <:cookie_deno:1002977285734932480>
7 replies
DDeno
Created by Aziz on 9/29/2023 in #help
Inquiry Regarding Deno Security Model and Command Injection Vulnerability
I do not fully understand your question. By running deno with --allow-net and --allow-run you're giving explicit permision for deno to access all network features and run commands. You can narrow down these permissions by using the following syntax: --allow-read=.env,main.bin
7 replies
DDeno
Created by notiggsam on 9/17/2023 in #help
UUID of managed KV database
populate it with some values and that'll appear
14 replies
DDeno
Created by notiggsam on 9/17/2023 in #help
UUID of managed KV database
That is because you haven't used kv yet
14 replies
DDeno
Created by notiggsam on 9/17/2023 in #help
UUID of managed KV database
Whats the name of your project? Change it in the following link and try again: https://dash.deno.com/projects/$YOUR_PRROJECT/kv
14 replies
DDeno
Created by FjordWarden on 9/17/2023 in #help
Can't import typescript module
you can however use the js version and add @deno-types="…" above the import to have typescript support
3 replies
DDeno
Created by FjordWarden on 9/17/2023 in #help
Can't import typescript module
you can’t import a d.ts file, that’s only type definitions
3 replies
DDeno
Created by Kay on 9/14/2023 in #help
WalkSync dosnt get files
you need a for … of loop not a for … in
3 replies
DDeno
Created by Mqx on 9/4/2023 in #help
dlopen() from web url
3 replies
DDeno
Created by carlostech on 8/30/2023 in #help
Need some help for Deno/FreshJS project
You can always ask here and someone will eventually help, no need to ask to ask <:cookie_deno:1002977285734932480>
3 replies
DDeno
Created by Aléki on 8/9/2023 in #help
Looking for caching API Responses
<:to_anime1_wave:965663270310658109>
7 replies
DDeno
Created by Aléki on 8/9/2023 in #help
Looking for caching API Responses
You need access to kv's beta for it to work on deploy
7 replies