new File(impl)
Parameters:
Name | Type | Description |
---|---|---|
impl |
FileImpl | An object that implements file data storage and server requests. |
Members
-
<readonly> created :string
-
File creation time (UTC) in the format specified in ISO 8601.
Type:
- string
-
<readonly> customFields :Object
-
File custom fields object, to store custom data.
Type:
- Object
-
<readonly> data :Object
-
Raw file data received from the server.
Type:
- Object
-
<readonly> exports :Array.<string>
-
Returns an array of types the file can be exported to.
Type:
- Array.<string>
-
<readonly> geometryStatus :string
-
Geometry data extracting status. Can be
none
,waiting
,inprogress
,done
orfailed
.Type:
- string
-
<readonly> id :string
-
Unique file ID.
Type:
- string
-
<readonly> metadata :boolean
-
true
when file have geometry data.Type:
- boolean
-
name :string
-
File name, including the extension.
Type:
- string
-
<readonly> owner :string
-
File owner ID. Use Client.getUser() to obtain detailed owner information.
Type:
- string
-
<readonly> previewUrl :string
-
File preview image URL. Use setPreview() to change preview image.
Type:
- string
-
<readonly> properties :boolean
-
true
when file have properties.Type:
- boolean
-
<readonly> propertiesStatus :string
-
Properties extracting status. Can be
none
,waiting
,inprogress
,done
orfailed
.Type:
- string
-
<readonly> size :number
-
File size in bytes.
Type:
- number
-
<readonly> type :string
-
File type, matches the file extension.
Type:
- string
-
<readonly> validationStatus :string
-
File validation status. Can be
none
,waiting
,inprogress
,done
orfailed
.Type:
- string
Methods
-
<async> checkout()
-
Refresh file data.
Returns:
- Type
- Promise.<File>
-
<async> createPermission(actions, grantedTo, public)
-
Create a new file permission.
Parameters:
Name Type Default Description actions
string | Array.<string> Actions are allowed to be performed on a file with this permission. See Permission.actions for more details.
grantedTo
Array.<Principial> A collection of principials that will get access to the file.
public
Boolean false Specifies whether all users have access to the file or not.
Returns:
- Type
- Promise.<Permission>
-
<async> delete()
-
Delete the file from the server.
Returns:
- Returns the raw data of a deleted file.
- Type
- Promise.<Object>
-
<async> deletePermission(permissionId)
-
Delete file permission.
Parameters:
Name Type Description permissionId
string Permission ID.
Returns:
- Returns the raw data of a deleted permission.
- Type
- Promise.<Object>
-
<async> deleteViewpoint(guid)
-
Delete file viewpoint.
Parameters:
Name Type Description guid
string Viewpoint GUID.
Returns:
- Returns the raw data of a deleted viewpoint.
- Type
- Promise.<Object>
-
<async> downloadResource(dataId, onProgress, signal)
-
Download file resource data, such as geometry database or geometry data.
Parameters:
Name Type Description dataId
string Resource ID.
onProgress
ProgressCallback Download progress callback.
signal
AbortSignal An AbortSignal object instance. Allows to communicate with a fetch request and abort it if desired.
Returns:
- Type
- Promise.<ArrayBuffer>
-
<async> extractGeometry()
-
Create job for extract file geometry data.
Returns:
- Type
- Promise.<Job>
-
<async> extractProperties()
-
Create job for extract file properties.
Returns:
- Type
- Promise.<Job>
-
<async> getModels()
-
Returns list of file models.
Returns:
- Type
- Promise.<Array.<Model>>
-
<async> getPermission(permissionId)
-
Returns the permission information.
Parameters:
Name Type Description permissionId
string Permission ID.
Returns:
- Type
- Promise.<Permission>
-
<async> getPermissions()
-
Returns a list of file permissions.
Returns:
- Type
- Promise.<Array.<Permission>>
-
<async> getProperties( [handle])
-
Returns the properties for an object in the file.
Parameters:
Name Type Argument Description handle
string <optional>
Object original handle. Leave this parameter
undefined
to get properties for all objects in the file.Returns:
- Type
- Promise.<Array.<Properties>> | Promise.<Properties>
-
<async> getReferences( [signal])
-
Returns a file references.
Parameters:
Name Type Argument Description signal
AbortSignal <optional>
Returns:
- Type
- Promise.<FileReferences>
-
<async> getSnapshot(guid)
-
Returns viewpoint preview image as Data URL.
Parameters:
Name Type Description guid
string Viewpoint GUID.
Returns:
- Type
- Promise.<string>
-
<async> getSnapshotData(guid, bitmapGuid)
-
Returns viewpoint preview data.
Parameters:
Name Type Description guid
string Viewpoint GUID.
bitmapGuid
string Bitmap GUID.
Returns:
- Type
- Promise.<string>
-
<async> getViewpoints()
-
Returns a list of file viewpoints.
Returns:
- Type
- Promise.<Array.<Object>>
-
<async> save()
-
Save file data changes to the server. Call this method to update file data on the server after any changes.
Returns:
- Type
- Promise.<File>
-
<async> saveViewpoint(viewpoint)
-
Add new file viewpoint. To create a new viewpoint use Viewer.createViewpoint().
Parameters:
Name Type Description viewpoint
Object Viewpoint.
Returns:
- Type
- Promise.<Object>
-
<async> searchProperties(searchPattern)
-
Returns the list of original handles for an objects in the file that match the specified patterns. Search patterns may be combined using query operators.
Parameters:
Name Type Description searchPattern
SearchPattern | QueryOperator Search pattern or combination of the patterns, see example below.
Returns:
- Type
- Promise.<Array.<Properties>>
Examples
Simple search pattern.
searchPattern = { key: "Category", value: "OST_Stairs", };
Search patterns combination.
searchPattern = { $or: [ { $and: [ { key: "Category", value: "OST_GenericModel" }, { key: "Level", value: "03 - Floor" }, ], }, { key: "Category", value: "OST_Stairs" }, ], };
-
<async> setPreview(image)
-
Set or remove the file preview.
Parameters:
Name Type Description image
string | ArrayBuffer | Blob | file | null Preview image. Can be a Data URL string, ArrayBuffer, Blob or Web API File object. Setting the
image
tonull
will remove the preview.Returns:
- Type
- Promise.<File>
-
<async> setReferences(references)
-
Set the file references.
Parameters:
Name Type Description references
FileReferences File references.
Returns:
- Type
- Promise.<FileReferences>
-
<async> update(data)
-
Update file data on the server.
Parameters:
Name Type Description data
Object Raw file data.
Returns:
- Type
- Promise.<File>
-
<async> validate()
-
Create a job to validate the file.
Returns:
- Type
- Promise.<Job>
-
<async> waitForDone(job [, waitAll] [, params])
-
Wait until file jobs is done. File job is done when it changes to
none
,done
orfailed
status.Parameters:
Name Type Argument Description job
string | Array.<string> Job or job array to wait on. Can be
geometry
,properties
orvalidation
.waitAll
Boolean <optional>
If this parameter is
true
, the function returns when all the specified jobs have done. Iffalse
, the function returns when any one of the jobs are done.params
Object <optional>
An object containing waiting parameters.
Properties
Name Type Argument Description timeout
Number <optional>
The time, in milliseconds that the function should wait jobs. If no one jobs are done during this time, the
TimeoutError
exception will be thrown.interval
Number <optional>
The time, in milliseconds, the function should delay in between checking jobs status.
signal
AbortSignal <optional>
An AbortController signal object instance, which can be used to abort waiting as desired.
Returns:
- Type
- Promise.<File>