Back

PATH in function?

  • 0
  • Self Hosted
ZachHandley
25 Oct, 2023, 05:44

Hey -- trying to include JSON files in my function path, it bundles them with it (basd on the size) but trying to actually reference them is near impossible. ./myjsonfiles_directory doesn't work, neither does path.resolve nor path.dirname() lmao, what should I be using here?

TL;DR
User is asking for help on including JSON files in their function path. They have tried using `./myjsonfiles_directory`, `path.resolve`, and `path.dirname()` but none of them work. They are seeking suggestions for a solution.
Drake
25 Oct, 2023, 18:03

Python?

ZachHandley
25 Oct, 2023, 18:55

JavaScript actually, Node or Bun both

ZachHandley
25 Oct, 2023, 18:56

I ended up importing the files directly via import some file from “some file.json” { assert type: string }

Drake
25 Oct, 2023, 19:39

ya that's probably the best way to go

Drake
25 Oct, 2023, 19:40

otherwise, you can do some path magic stuff like how some of our templates looks up a static folder: https://github.com/appwrite/templates/blob/d8fa2bb59acdd867c7fa633fe95f703531e13d69/node/censor-with-redact/src/utils.js#L23-L25

ZachHandley
25 Oct, 2023, 20:50

gotcha thank you!!

ZachHandley
25 Oct, 2023, 20:50

how versatile

ZachHandley
25 Oct, 2023, 20:50

are the build commands

ZachHandley
25 Oct, 2023, 20:51

can I customize the image a lot more (like for instance install Poetry) if I add build commands?

ZachHandley
25 Oct, 2023, 20:51

maybe best in a separate thread

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more