Monday, November 18, 2024
Google search engine
HomeLanguagesJavascriptp5.js IO Complete Reference

p5.js IO Complete Reference

p5.js IO is the implementation of the transport-based cross-browser/cross-device bi-directional communication layer. The input and output functions are mentions below.

Input

Description

loadJSON() It is used to read the contents of a JSON file or URL and return it as an object.
loadStrings() It is used to read the contents of a file and create an array of strings with each of the lines of the file.
loadTable() It is used to read the contents of a file or URL and create a p5.Table object from it.
loadXML() It is used to read the contents of a file or URL and return it as a XML object.
loadBytes() It is used to read the contents of a file or URL and return it as an object containing the series of bytes.
httpGet() httpGet() function is used to execute an HTTP GET request.
httpPost() httpPost() function is used to execute an HTTP POST request.
httpDo() httpDo() function is used to execute an HTTP request.

Output

Description

createWriter() It creates a p5.PrintWriter object that can be used to write or print to various available streams.
save() It is used to save to the file system by prompting a download to the computer.
saveJSON() It is used to write an object or array of objects as a JSON object to the .json file.
saveStrings() It is used to write an array of strings with one line per string to the file.
saveTable() saveTable() function is used to save a p5.Table object to a file.

Table:

p5.Table

Description

matchRows() It is used to find all the rows that match the given regular expression.
clearRows() clearRows() method is used to clear all rows in a table.
findRow() It is used to find the first row that contains the given and value and returns a value to that row.
findRows() It is used to find all the rows that contain the given and value and returns a reference to those rows.
set() It is used to store the given value to the given row and column of the table.
removeRow() removeRow() method is used to remove the given row from a table.
get() It is used to retrieve a value from the given row and column of the table.
getRows() It returns a reference to all rows in the table as an array of p5.TableRow objects.
removeTokens() It is used to remove all the specified characters from values in the table.
getString() It is used to retrieve a String value from the given row and column of the table.
getRowCount() It is used to return the total number of rows in a table object.

p5.TableRow

Description

get() It is used to retrieve a value from the given column of the table row.
getString() It is used to retrieve a String value from the given column of the table row.
setString() It is used to store the given String value to the given column of the table row.
getNum() It is used to retrieve a Float value from the given column of the table row.
setNum() It is used to store the given Float value to the given column of the table.
set() It is used to store the given value to the given column of the table.

Time and Date:

Time & Date

Description

day() day() function used to get the current day from the system’s clock.
hour() hour() function is used to return the current hour from the system clock.
minute() minute() function is used to return the current minute in the system clock.
millis() millis() function is used to return the number of milliseconds from starting the program.
month() month() function is used to get the current month from the system’s clock.
second() second() function is used to return the current second of the system clock.
year() year() function is used to return the current year from the system clock.
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

RELATED ARTICLES

Most Popular

Recent Comments