readTextFile() not working?

what is this? its there but its not working
No description
DAHDeno AI Helper10/26/2023
I'm sorry to hear that you're having trouble with readTextFile(). This function is used to asynchronously read and return the entire contents of a file as an UTF-8 decoded string. If you're trying to read a directory, it will throw an error. Here's a basic usage example from the documentation:
const data = await Deno.readTextFile("hello.txt");
const data = await Deno.readTextFile("hello.txt");
This code reads a file named "hello.txt" and logs its contents to the console. Remember that this function is asynchronous, so you need to use await to wait for the promise to resolve. If you're still having trouble, could you please provide more details about the issue? For example: - What is the exact error message you're seeing? - Can you share the code that's causing the problem? - Are you sure the file you're trying to read exists and is accessible? - Did you provide the --allow-read flag when running your script? This is required to give Deno permission to read from the filesystem. These details will help me assist you better. 🦕
I would suggest to try “./config.toml” Otherwise please provide more details Silencing the linter might have lead to an unnoticed type error
^ what he said. The file path is relative to the current working directory of Deno, not to the calling script you can check what the working dir is with Deno.cwd();. If you really want to use script relative paths, import.meta.resolve("../hello.txt") might do the trick

Looking for more? Join the community!

Recommended Posts
kv store key granualityHow cheap are the `kv.get` operations? Say I have a userprofile with 3 fields, should I create 3 kedeno tap metadataHello. I am running deno tests with `deno test --reporter=tap`. I would like to add additional fieldUsing ESBuild with DenoHey, is anyone more familiar with ESBuild? I am currently trying to transpile my Deno TypeScript proMultiple subdomainsHow can I listen for incoming http request on multiple subdomains?Can't upgrade request to websocketI want to use a websocket in one of my middlewares. But I keep getting an error saying I can't upgrAccess `navigator.geolocation` in deno runtimeHello, is it possible to access `navigator.geolocation` in the deno runtime?Tracking Down Lost MemoryHi, I have a long running service that creates many `JsRuntime`s over time and I have found that I `deno run` ignores @deno-types?```ts Uncaught SyntaxError: The requested module 'pg' does not provide an export named 'Pool' importWhere is my Twitter access token with Deno KV Oauth?I signed in successfully and now the Deno KV database is just storing `true`. It's not enough to intHow do I import the stripe SDK into my fresh.js projectHi there! How do I import the stripe SDK into my fresh.js project? Im struggling with my deno.json fUnable to find NPM:Rollup 4.1.4 on M1 MacHi all, hooking up a new build process for UI project, trying to use Rollup on an M1 Mac. My build How to get custom folder structure with Fresh?Hello, I want to integrate Fresh into my existing project. I want to use the 4 directories: componenFresh error: Could not fetch latest versionTotal newbie here. I'm getting "Update check failed: Could not fetch latest version." when I make a VSCode Test Debugging```json { "name": "Test", "request": "launch", "type": "node", "cwd": "$Can you recommend a mysql driver for deno that isn't a complete dead end?mysql2 port: never updated. mysql driver: doesn't support strings mysql connector from Oracle: no onHelp with Slack CLI DeploymentSorry if this has already been answered, but I am trying to deploy my Slack app and I keep getting tOrganizing dependencies in workspace with several project folderSuppose you have a workspace with several folder, and in each folder you have a deno project. What iGitHub CLI from denoIs it possible/how to use the GitHub cli (gh) from JavaScript on deno? Using the `Github cli` I'm ab