Files

You can upload files to use in your Napkin functions. Go to the Other tab in the Napkin editor and scroll down to Files. You can upload any file as long as its size is less than 1MB.

Once uploaded, your function can access your files via the /opt/files directory. You can access your files using the usual builtin modules for both Javascript and Python. For example, assuming you've uploaded a file called file.txt, here's how you can print the contents of the file:

with open('/opt/files/file.txt', 'r') as f:
  contents = f.read()

print(contents)