10-11-2017 15:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-11-2017 15:00
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I'm trying to read some binary data. I've added a file called "level_data.bin" to the resources folder but I can't open it for reading.
import * as fs from "fs";
let file = fs.openSync("../resources/level_data.bin", "r");
- [22:31:17]App Started
- [22:31:17]Unhandled Error
- [22:31:17]Couldn't open file: ../resources/level_data.bin
- [22:31:17] at ./app/index.js:30:9
- at ./app/index.js:21:5
- at ./app/index.js:54:1
I've tried it with / and \ and no path at all, thinking it might automatically look in the resources folder. I've also tried the file in the app folder (so there's no relative path), but it just can't open it.
Answered! Go to the Best Answer.

Accepted Solutions
10-13-2017 12:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-13-2017 12:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hey Allan!
Can you try: /mnt/assets/resources/
Let me know how you get on!
10-12-2017 12:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-12-2017 12:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Are you certain the file is being copied to the app?
You can download the packaged app (option on the top toolbar inside Studio) and unpack it to see if the file is indeed being packed or not. I'm not certain of how they have rollup configured, so you might have to figure out a clever hack for getting it bundled if not. (Just a hunch)

10-12-2017 12:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-12-2017 12:20
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Good point! I will check that and see when I get back on my computer.

10-13-2017 02:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-13-2017 02:05
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I've checked the package and the file is definitely there, and definitely in the resources folder.

10-13-2017 12:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


10-13-2017 12:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Hey Allan!
Can you try: /mnt/assets/resources/
Let me know how you get on!
10-13-2017 12:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

10-13-2017 12:51
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
It got past the load, now to figure out how to actually access the data!
Thanks.

