File management
novaos.createFile()
Create a File in a folder with specified content. This is an asynchronous function. Usage Example:
where
folderName
is the Folder Name the file should be saved in (available:Downloads
andApps
), andfileName
is the File Name the file should be saved as. This should not contain a file extension, learn how to remove file extensions with Nova.js.type
is the type of the file, for example,app
,txt
etc.content
is the file content / value.
OpenL()
OpenL()
Formally, Open Launch Protocol (OpenL) lets you open a default app with given data. This is an asynchronous function. Usage Example:
where
appname
is the name of the app that it is going to open (Only Default Apps)
⚠ OpenL uses openapp() function, which is deprecated and can cause apps to be rewritten with error screens if there's connection issues.
The data
given in this function will be saved in a localStorage
key, which is todo
. This will be saved in this following format:
This data can later be read by the opened app (only the text app reads such.), in case you want to open something in the text app with the OL protocol, then here you go:
Opening the Text App with OLP
where
UID
is an Identification of a File, usually it is a 6 Characters long string assigned to every single file in Nova. You may obtain it using the following function (getFileNamesByFolder)
⚠ This function is deprecated and may be replaced with a more proper and efficient function in near future. Try to not use this on production.
getFileNamesByFolder()
getFileNamesByFolder()
Get an object that has name
and id
(UID) of all files in a folder.
Usage Example:
where folderName is the target Folder's Name.
getFileByPath()
getFileByPath()
Get a file content with a path. This is an asynchronous function.
Usage Example:
where
path
is the path of the file.
What is a path? A path is a string, separated by slashes (/). This string starts with the folder name and ends with the file name.
Edge cases What happens if the folder contains more than one unique file with that name? well, the function returns an object (array) with all the files.
But, if you have the UID of a file that exists, how can you get its content?
getFileById()
getFileById()
Get a file content with a UID. This is an asynchronous function.
This function is resource intensive, try using
getFileNamesByFolder()
if you are collecting many files.
Usage Example:
Last updated