Methods
-
append_file(fileId, content, charset) → {string}
Append data to an existing file. Works only for uploaded files.
-
Append data to an existing file, or create a new file if no file is mentioned. Only work with uploaded files.
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be appended. A new file is created if fileId is empty. content
string Content to be appended charset
string <optional>
UTF-8 Character set of the content to be appended. More information about character sets Returns:
Identifier of the appended or created file- Type
- string
-
create_file(name, content, options) → {string}
Create a new file. Works only for uploaded files.
-
Parameters:
Name Type Description name
string Name of the new uploaded file. content
string Content to be added to the file options
fileoptions Options to create the file Returns:
Identifier of the created file- Type
- string
-
create_file(name, content, charset, contentType) → {string}
Create a new file. Works only for uploaded files.
-
Parameters:
Name Type Argument Default Description name
string Name of the new uploaded file. content
string Content to be added to the file charset
string <optional>
UTF-8 Character set of the content. More information about character sets contentType
string <optional>
auto discovered media type of the content - Deprecated:
- Use @see create_file with options instead
Returns:
Identifier of the created file- Type
- string
-
delete_file(fileId) → {boolean}
Delete an existing file. Works only for uploaded files.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be deleted Returns:
- Type
- boolean
-
file_replace(fileId, search, replacedBy, flag, algorithm, charset) → {string}
Replace the occurrences of a string in a file and save it. Works only for uploaded files.
-
Parameters:
Name Type Argument Default Description fileId
string ID of the file to be modified search
string String or regex to matched and replaced replacedBy
string Replacement string flag
searchflag <optional>
flag modifying the search method. By default `search`is considered as a plain string and all occurrences are replaced. algorithm
algorithm <optional>
none Algorithm to be used to decode the content. charset
string <optional>
UTF-8 Character set of the content to be read. More information about character sets Returns:
File identifier- Type
- string
-
R_file_content(fileId, algorithm, charset) → {string}
Read the content of a file.
-
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be read algorithm
algorithm Encoding algorithm. charset
string <optional>
UTF-8 Character set of the content to be read. More information about character sets Returns:
File content- Type
- string
-
R_file_desc(fileId) → {filedescriptor}
Get the metadata describing a file on the platform.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be read Returns:
File description- Type
- filedescriptor
-
R_file_index_of(fileId, substring, from, algorithm, charset) → {integer}
Find the index of the first occurrence of a string in a file.
-
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be read substring
string String to be search in the file content from
integer <optional>
0 Index to start from in the file algorithm
algorithm <optional>
none Algorithm to be used to decode the content. charset
string <optional>
UTF-8 Character set of the content to be read. More information about character sets Returns:
Index of the first occurrence or -1 if nothing found.- Type
- integer
-
R_file_last_index_of(fileId, substring, from, algorithm, charset) → {integer}
Find the the last occurrence of a string in a file.
-
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be read substring
string String to be search in the file content from
integer <optional>
0 Index to start from in the file algorithm
algorithm <optional>
none Algorithm to be used to decode the content. charset
string <optional>
UTF-8 Character set of the content to be read. More information about character sets Returns:
Index of the first occurrence or -1 if nothing found.- Type
- integer
-
R_file_size(fileId) → {integer}
Get the size in KBytes of a file on the platform.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be read Returns:
Size in KBytes- Type
- integer
-
R_file_substring(fileId, substring, from, to, algorithm, charset) → {integer}
Find the index of the first occurrence of a string in a file.
-
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be read substring
string String to be search in the file content from
integer <optional>
0 Index to start from in the file to
integer <optional>
end of file Index to stop at in the file algorithm
algorithm <optional>
none Algorithm to be used to decode the content. charset
string <optional>
UTF-8 Character set of the content to be read. More information about character sets Returns:
Index of the first occurrence or -1 if nothing found.- Type
- integer
-
R_read_excel_cells(fileId, cells) → {cellsdescriptor}
Read cells from an Excel worksheet.
-
Parameters:
Name Type Description fileId
integer Identifier of the Excel file uploaded on the platform cells
worksheet Worksheet descriptor listing the cells to be read Returns:
- Type
- cellsdescriptor
Example
// MyWorksheet is a worksheet in an Excel file uploaded with ID fe68f660-df8d-11e1-8a0e-1231390a5172 // cells = [{"worksheet":"MyWorksheet1","cells":[{"col":"1","row":"5"},{"col":"2","row":"5"},{"col":"3","row":"4"}]},{"worksheet":"MyWorksheet2","cells":[{"col":"1","row":"2"},{"col":"2","row":"2"},{"col":"3","row":"2"}]}] ${read_excel_cells("fe68f660-df8d-11e1-8a0e-1231390a5172",cells)} // returns {"MyWorksheet2":{"2":{"1":"1","2":"a value","3":""}},"MyWorksheet1":{"4":{"3":""},"5":{"1":"4","2":"another value!"}}}
-
save_file(fileId, content, charset) → {string}
Overwrite an existing file. Works only for uploaded files.
-
Parameters:
Name Type Argument Default Description fileId
string Identifier of the file to be overidden content
string New content of the file charset
string <optional>
UTF-8 Character set of the new content. More information about character sets - Deprecated:
- Use @see save_file with options instead
Returns:
Identifier of the file- Type
- string
-
save_file(fileId, content, options) → {string}
Overwrite an existing file. Works only for uploaded files.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be overidden content
string New content of the file options
fileoptions File options Returns:
Identifier of the file- Type
- string
-
save_file_desc(fileId, metadata) → {filedescriptor}
Modify the metadata describing a file on the platform.
-
Parameters:
Name Type Description fileId
string Identifier of the file to update metadata
filedescriptor New metadata of the file Returns:
New metadata of the file.- Type
- filedescriptor
-
unzip_file(fileId) → {filedescriptor}
Unzip a file, and create a new file with the unzipped data. Works only for uploaded files.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be overidden Returns:
Metadata of the new (unzipped) file- Type
- filedescriptor
-
update_file(fileId, name, contentType) → {string}
Update file metadata. Works only for uploaded files.
-
Parameters:
Name Type Description fileId
string Identifier of the file to be overidden name
string New name of the file contentType
string New content type of the file - Deprecated:
- Use @see save_file_desc instead
Returns:
Identifier of the file- Type
- string
-
zip_file(fileId, name) → {string}
Zip an file, and create a new file with the zipped data. Works only for uploaded files.
-
Parameters:
Name Type Description fileId
string | array Identifier of the file to be overidden **or** list of files to be added to the zip archive in a JSONArray format name
string Name of the new zip file to be created Returns:
Identifier of the new zip file- Type
- string