Accessing custom files
You can access custom files using any language (apart from HTML + CSS + JS and PlainText pads). With each language, access the file by utilizing the specific command to read files using the path we provide.
Examples
The example below is using a file named test.csv
. Within the pad environment, the file will be available at the path ./data/test.csv
.
Python
with open('./data/test.csv', 'w') as f:
print >> f, 'Filename:', filename # Python 2.x
print('Filename:', filename, file=f) # Python 3.x
Javascript
let fs = require(“fs)
const csv = fs.readFileSync(‘./data/test.csv’)
console.log(csv.toString());
Java
File file = new File("./data/test.csv");
Ruby
puts File.open(‘./data/test.csv’)
If you have trouble accessing the file output, please contact support for more help.