File System
Supercharge your scripts through WayScript's File System
WayScript's File System is attached to each script you build on the WayScript platform. Navigate to the File System in the WayScript editor to browse your script's file directory, and create or upload a file as a persistent resource (just like on your local machine!) that you can reference in any module of your script.
Check out our tutorial on how to get started with the File System.

​
πŸ”
Accessing the File System

The WayScript File System is always available through through the left menu in the script editor.

Structure

    Each of your scripts on WayScript automatically generate a folder with the same name as the script title. This folder can not be renamed or deleted.
    Scratch files generated through WayScript's Code modules are stored in a .ws file with the same name as the script title. This file cannot be renamed or deleted.
    You may create additional folders within each script folder to organize your files.

Uploading and Creating Files / Folders

    You can use the overflow menu on any file to upload or create a new file or folder.
    WayScript supports most major file formats. However, you can only edit a select list of text-based formats and preview a select list of image and document formats.

​
πŸ”—
Referencing Files

File Scoping

    By default, files are stored at the script-level inside a folder with the same name as the script. Files contained in this folder can only be referenced by modules and other files also located within this folder.
    Files can also be stored in your account-level folder. These files can be referenced by any script in your account.
    Note: The same scoping is true for files stored under a Team account.
    Files can be referenced outside of the WayScript platform by making them public. This will generated a static URL that references the file.
Toggle whether a file can be publicly accessed

Referencing Files within Code

Python
Java
HTML
Shell
A file located in your script directory can be referenced in the following ways.
    f = open('demofile.txt', 'r') OR
    f = open('/<username>/<script_name>/demofile.txt', 'r')
You can also import functions or classes between Python files located in your script directory, e.g.:
1
# import_test.py
2
def testFunction():
3
return("Hello World")
4
5
# main.py
6
from import_test import testFunction
7
print(testFunction())
Copied!
A file located in your script directory can be referenced in the following ways.
    File myObj = new File("demofile.txt"); OR
    File myObj = new File("/<username>/<script_name>/demofile.txt");
You can also import methods between Java files located in your script directory, e.g.:
1
# Other.java
2
public static void testMethod()
3
{
4
// code to be executed....
5
}
6
​
7
# Test.java
8
Other.TestMethod();
Copied!
Currently, files cannot directly be referenced by their file-path through HTML src attribute. However, you can make files public to generate a static URL that references the file, as shown below.
<img src="https://wayscript.com/file?token=IjEyMjk0LTY0MSI.V_JeT6I-kLMqc8jDrChzBQCVI30">
    You can use basic file directory and manipulation Shell commands, such as ls, cd , and mkdir, to interact with the WayScript File System.
    The current directory is always set initially within your script folder.

Referencing Files within Modules

Many of WayScript's modules offer a way to select a file from the File System to read in as an input or write to as an output.
For example, in the CSV module, choosing a file to read opens a view of the File System which allows you to select the right file, create a new file, or upload a file from your local environment. This selector will only permit you select a supported file format for that corresponding module.
Our File Actions module also allows you to create a WayScript File Variable from raw byte data, which can then be used in other modules. See the module documentation for more details.
Last modified 8mo ago