informat.storage File Sharing Storage Operations
Overview
Use the informat.storage object for file sharing storage operations. File sharing storage uses the S3 protocol and is stored on the file server. All files below will be stored in the shared storage.
Terminology
- Shared Storage: Please refer to the Shared Storage documentation
exists
Check if a file exists
informat.storage.exists(path);| Parameter | Type | Description |
|---|---|---|
| path | String | File path |
Return Value Boolean
Returns whether the file exists
Example
// Check if a file exists for the specified module attachment field in the current application
const path = "moduleId/fieldId/fileId";
var result = informat.storage.exists(path);
if (result) {
console.log("File exists");
} else {
console.log("File does not exist");
}listFile
Return the list of files in a folder
informat.storage.listFile(path);| Parameter | Type | Description |
|---|---|---|
| path | String | File path |
Return Value Array<String>
Returns the list of files in the folder
Example
// Get all files of the current application
const fileList = informat.storage.listFile("/");
console.log("fileList", fileList);Return data example:
[
'fileId',
'moduleId/fieldId/fileId',
'moduleId/fieldId/fileId2',
...
]move
Move a file from the specified path to the target path. Note: If a file with the same name exists at the target path, it will be overwritten
informat.storage.move(source, target);| Parameter | Type | Description |
|---|---|---|
| source | String | Source file path |
| target | String | Target path |
Return Value
None
Example
// Move the specified file to the application root directory
const source = "moduleId/fieldId/fileId";
const target = "fileId";
informat.storage.move(source, target);copy
Copy a file from the specified path to the target path. Note: If a file with the same name exists at the target path, it will be overwritten
informat.storage.copy(source, target);| Parameter | Type | Description |
|---|---|---|
| source | String | Source file path |
| target | String | Target path |
Return Value
None
Example
// Create a copy of the specified file
const source = "moduleId/fieldId/fileId";
const target = "moduleId/fieldId/fileIdCopy";
informat.storage.copy(source, target);delete
Delete a file
If the file corresponding to the path does not exist, the system will report a File does not exist error; If the path corresponds to a folder rather than a file, the system will report a File does not exist error;
informat.storage.delete(path);| Parameter | Type | Description |
|---|---|---|
| path | String | File path |
Return Value
None
Example
// Delete the file for the specified module attachment field in the current application
const path = "moduleId/fieldId/fileId";
informat.storage.delete(path);deleteDirectory
Delete a folder
If the folder corresponding to the path does not exist, the system will report a File does not exist error; If the path corresponds to a file rather than a folder, the system will report a File does not exist error;
informat.storage.deleteDirectory(path);| Parameter | Type | Description |
|---|---|---|
| path | String | Folder path |
Return Value
None
Example
// Delete all files for the specified module attachment field in the current application
const path = "moduleId/fieldId";
informat.storage.deleteDirectory(path);download
Download a file from shared storage to the local sandbox environment. Note: If a file with the same name exists locally, it will be overwritten
informat.storage.download(path, localPath);| Parameter | Type | Description |
|---|---|---|
| path | String | File path |
| localPath | String | Local sandbox environment file path |
Return Value
None
Example
// Download the specified shared storage file to the local root directory for the current application
const path = "moduleId/fieldId/fileId";
const localPath = "local.png";
informat.storage.download(path, localPath);upload
Upload a local file to shared storage. Note: If a file with the same name exists locally, it will be overwritten
informat.storage.upload(localPath, remotePath);| Parameter | Type | Description |
|---|---|---|
| localPath | String | Local file path |
| remotePath | String | Shared storage path |
Return Value
None
Example
// Upload the specified local file to the shared storage root directory for the current application
const localPath = "local.png";
const remotePath = "remote.png";
informat.storage.upload(localPath, remotePath);uploadFromURL
Upload a file from a remote URL to shared storage
informat.storage.uploadFromURL(url, remotePath);| Parameter | Type | Description |
|---|---|---|
| url | String | Remote URL |
| remotePath | String | Shared storage path |
Return Value
None
Example
// Upload a remote file to the shared storage root directory for the current application
const url = "https:/example.com/file.jpg";
const remotePath = "file.jpg";
informat.storage.uploadFromURL(url, remotePath);getFilePath
Get file path
informat.storage.getFilePath(tableKey, fieldKey, fileId);| Parameter | Type | Description |
|---|---|---|
| tableKey | String | Data table identifier |
| fieldKey | String | Field identifier |
| fileId | String | File ID |
Return Value String
Shared storage file path
Example
// Get the file path for the data table identifier "goods", field identifier "pic", and file ID "fileId"
const filePath = informat.storage.getFilePath("goods", "pic", "fileId");
console.log("File path---->", filePath); // File path---->goodsmoduleId/picFieldId/fileIdcreateFileToken
Create file access Token
informat.storage.createFileToken(path, fileName, expireTime);| Parameter | Type | Description |
|---|---|---|
| path | String | Shared storage file path |
| fileName | String | File name, can be empty |
| expireTime | Integer | Expiration time in seconds |
createFileDownloadUrl
Create file download URL
informat.storage.createFileDownloadUrl(fileToken);| Parameter | Type | Description |
|---|---|---|
| fileToken | String | File access TOKEN |
createFileDownloadUrl
Create file download URL
informat.storage.createFileDownloadUrl(fileToken, host);| Parameter | Type | Description |
|---|---|---|
| fileToken | String | File access TOKEN |
| host | String | Web service address, can be empty, defaults to external network access address |
convertFormat
Document format conversion
informat.storage.convertFormat(sourcePath, targetPath, setting);| Parameter | Type | Description |
|---|---|---|
| sourcePath | String | Path of the document to convert |
| targetPath | String | Target document path after successful conversion |
| setting | ConvertSetting | Conversion settings |
convertFormat
Document format conversion
informat.storage.convertFormat(sourcePath, targetPath, onlyofficeServiceUrl, setting);| Parameter | Type | Description |
|---|---|---|
| sourcePath | String | Path of the document to convert |
| targetPath | String | Target document path after successful conversion |
| onlyofficeServiceUrl | String | OnlyOffice service address, defaults to the file preview address configured in the management backend |
| setting | ConvertSetting | Conversion settings |
The ConvertSetting structure is as follows
{
async:Boolean,//Define the conversion request type: synchronous or asynchronous
fileType:String,//Define the type of document file to be converted.
outputtype:String,//Define the type of converted document to be generated.
password:String,//If the document file is password protected, define the password for the file
region:String,//Define the default display format for currency, date, and time when converting from spreadsheet format to PDF. Use a four-letter language code (en-US, fr-FR, etc.) for settings. The default value is en-US.
title:String,//Define the filename after conversion
spreadsheetLayout:{
fitToHeight:Integer,//Set the height of the conversion area in pages. Default value is 0.
fitToWidth:Integer,//Set the width of the conversion area in pages. Default value is 0.
gridLines:Boolean,//Allow including or excluding gridlines in the output PDF file. Default value is false.
headings:Boolean,//Allow including or excluding headings in the output PDF file. Default value is false.
ignorePrintArea:Boolean,//Determine whether to ignore the print area selected for the spreadsheet file. Default value is true
margins:{
bottom:String,//Set the bottom margin of the output PDF file. Default value is 19.1 mm.
right:String,//Set the right margin of the output PDF file. Default value is 19.1 mm.
left:String,//Set the left margin of the output PDF file. Default value is 19.1 mm.
top:String,//Set the top margin of the output PDF file. Default value is 19.1 mm
},
orientation:String,//Set the orientation of the output PDF file. Can be landscape or portrait. Default value is portrait.
pageSize:{
height:String,//Set the page height of the output PDF file. Default value is 297 mm.
width:String//Set the page width of the output PDF file. Default value is 210 mm.
},
scale:Integer,//Allow setting the scale of the output PDF file. Default value is 100.
},
thumbnail:{
/*
Define the mode for fitting the image to the specified height and width. Supported values: 0 - Stretch the file to fit the height and width 1 - Maintain the image aspect ratio 2 - In this case, the width and height settings are not used. Instead, the metric dimensions of the page are converted to pixels at 96 dpi. For example, an A4 (210x297mm) page becomes an image with dimensions 794x1123 pixels. Default value: 2.
*/
aspect:Integer,
/*
Define whether to generate a thumbnail only for the first page or for all document pages.
If false, a zip archive containing thumbnails for all pages will be created.
Default value is true,
*/
first:Boolean,
height:Integer,//Define the thumbnail height in pixels. Default value is 100
width:Integer,//Define the thumbnail width in pixels. Default value is 100
}
}Supported File Conversion Table
Symbol Description:
- ⬤ Indicates full support for format conversion
- 〇 Indicates no support for format conversion
Text Document File Formats
| Input Format | bmp | docm | docx | dotm | dotx | epub | fb2 | gif | html | jpg | odt | ott | pdfa | png | rtf | txt | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| djvu | ⬤ | 〇 | 〇 | 〇 | 〇 | 〇 | 〇 | ⬤ | 〇 | ⬤ | 〇 | 〇 | ⬤ | ⬤ | ⬤ | 〇 | 〇 |
| doc | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| docm | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| docx | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| dot | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| dotm | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| dotx | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| epub | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| fb2 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| fodt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| htm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| html | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| hwp | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| hwpx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| mht | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| mhtml | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| odt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ott | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| oxps | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| pages | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | |
| rtf | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ |
| stw | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| sxw | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| txt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 |
| wps | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| wpt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xml | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xps | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
Spreadsheet File Formats
| Input Format | bmp | csv | gif | jpg | ods | ots | pdfa | png | xlsm | xlsx | xltm | xltx | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| csv | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| et | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ett | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| fods | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| numbers | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ods | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ots | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| sxc | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xls | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xlsb | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xlsm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ |
| xlsx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ |
| xlt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| xltm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ |
| xltx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 |
| xml | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
Presentation File Formats
| Input Format | bmp | gif | jpg | odp | otp | pdfa | png | potm | potx | ppsm | ppsx | pptm | pptx | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| dps | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| dpt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| fodp | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| key | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| odp | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| otp | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| pot | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| potm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| potx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ | ⬤ |
| pps | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| ppsm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ | ⬤ |
| ppsx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ | ⬤ |
| ppt | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
| pptm | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 | ⬤ |
| pptx | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | 〇 |
| sxi | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ | ⬤ |
Example:
Convert a file from docx format to pdf format
informat.storage.convertFormat("table/field/fileId", "table/field/fileId_converted", {
filetype: "docx",
outputtype: "pdf",
title: "test.pdf",
});Convert a file from docx format to png thumbnail
informat.storage.convertFormat("table/field/fileId", "table/field/fileId_converted", {
filetype: "docx",
outputtype: "png",
title: "test.png",
thumbnail: {
aspect: 0,
first: true,
height: 150,
width: 100,
},
});Convert a file from xlsx format to pdf format
informat.storage.convertFormat("table/field/fileId", "table/field/fileId_converted", {
filetype: "xlsx",
outputtype: "pdf",
title: "test.pdf",
region: "en-US",
spreadsheetLayout: {
ignorePrintArea: true,
orientation: "portrait",
fitToWidth: 0,
fitToHeight: 0,
scale: 100,
headings: false,
gridLines: false,
pageSize: {
width: "210mm",
height: "297mm",
},
margins: {
left: "17.8mm",
right: "17.8mm",
top: "19.1mm",
bottom: "19.1mm",
},
},
});convertFormatFromURL
Convert document format from remote URL
informat.storage.convertFormatFromURL(sourceURL, targetPath, setting);| Parameter | Type | Description |
|---|---|---|
| sourceURL | String | Remote URL of the document to convert |
| targetPath | String | Target document path after successful conversion |
| setting | ConvertSetting | Conversion settings |
The following is an example of converting a docx document to pdf format from a remote URL
informat.storage.convertFormatFromURL("https://xxx.xxx.xx/file/example.docx", "table/field/example.pdf", {
filetype: "docx",
outputtype: "pdf",
title: "test.pdf",
});convertFormatFromURL
Convert document format from remote URL
informat.storage.convertFormatFromURL(sourceURL, targetPath, onlyofficeServiceUrl, setting);| Parameter | Type | Description |
|---|---|---|
| sourceURL | String | Remote URL of the document to convert |
| targetPath | String | Target document path after successful conversion |
| onlyofficeServiceUrl | String | OnlyOffice service address, defaults to the file preview address configured in the management backend |
| setting | ConvertSetting | Conversion settings |
The following is an example of converting a docx document to pdf format from a remote URL
informat.storage.convertFormatFromURL("https://xxx.xxx.xx/file/example.docx", "table/field/example.pdf", null, {
filetype: "docx",
outputtype: "pdf",
title: "test.pdf",
});getContent
Get file string content from shared storage
informat.storage.getContent(path);| Parameter | Type | Description |
|---|---|---|
| path | String | Shared storage path |
informat.storage.getContent("d97x4vygqxxt4/h9fdepr09gw2h/wddvtgi7md7x47du59sd0.png");getBase64Content
Get file base64 encoded content from shared storage
informat.storage.getBase64Content(path);| Parameter | Type | Description |
|---|---|---|
| path | String | Shared storage path |
informat.storage.getBase64Content("d97x4vygqxxt4/h9fdepr09gw2h/wddvtgi7md7x47du59sd0.png");
