How to access local files with `fs.readFileSync`?

I tried to ask Tonic to access my local files using fs.readFileSync, but error message says there is no such folder or file.

The example can be found here

Thanks

Hi strategy explorer,

By “local” files, do you mean a file on your computer?

Thanks,

Francisco

yes, I mean local tsv files on my computer. Thanks

One thing you can do is just place them in their own notebook, in a template string. Then you can require it in another notebook.

So, for example, notebook the first: https://tonicdev.com/tolmasky/file-possible
Then, in another notebook: https://tonicdev.com/tolmasky/file-read

Hope this lets you do it,

Francisco

Those links in your reply just go to a 404 page now…

Really sorry – should be up now.

Hello Tonic team,

First of all just want to say I’m very impressed by your product, the technical challenges you guys face must be huge :slight_smile:

Going on the topic of filesystem, is there a virtual filesystem attached to every notebook, which would enable users to persist data tied to that specific notebook? That doesn’t seem to be the case today, see this Tonic example: https://tonicdev.com/louischatriot/57cd3c111acb531400b62a2a - on a standard machine, every time the script is run the counter is incremented, on Tonic a new object is created every time.

Tangential point: you showed how to read a notebook from another notebook, but is there a way to write a notebook from another notebook (very meta!).

Cheers,
Louis

1 Like

I agree with you, @louischatriot, but I can understand that implementing a virtual filesystem attached to every notebook is complex.

Maybe a solution is to use a service like Firebase?

What do you think? I didn’t take the time to try Firebase.