Members
mediaType
- Description:
Returns the media type of the file-ref object FileRef.
Returns the media type of the file-ref object FileRef.
Methods
(static) createFromLocalFile(filePathnon-null, mediaTypeopt) → {FileRef}
- Description:
Creates a FileRef instance from a local file path. If no media type is provided, it will be inferred from the file extension.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filePath |
string | Local file path, either absolute path or relative to the working directory. |
|
mediaType |
string |
<optional> |
Media type to identify the local file format. |
Returns:
A FileRef instance.
- Type
- FileRef
(static) createFromStream(inputStreamnon-null, mediaTypenon-null) → {FileRef}
- Description:
Creates a FileRef instance from a readable stream using the specified media type.
The stream is not read by this method but by consumers of file content i.e. the execute method of an operation such as CreatePDFOperation#execute .
Parameters:
Name | Type | Description |
---|---|---|
inputStream |
stream.Readable | Readable Stream representing the file. |
mediaType |
string | Media type to identify the file format. |
Returns:
A FileRef instance.
- Type
- FileRef
saveAsFile(destinationFilePathnon-null) → {Promise.<void>}
- Description:
Saves this file to the location specified by
destinationFilePath
. If this FileRef instance refers to a temporary local file created by the SDK, that temporary file is deleted.The directories mentioned in the specified argument are created if they do not exist.
Parameters:
Name | Type | Description |
---|---|---|
destinationFilePath |
string | Local file path, either an absolute path or relative to the working directory. |
Throws:
-
-
If the file already exists.
- Type
- Error
-
-
-
If this FileRef instance does not represent an operation result.
- Type
- Error
-
Returns:
A Promise
that resolves when the fileRef instance has been moved to the specified location.
- Type
- Promise.<void>
writeToStream(writableStreamnon-null)
- Description:
Writes the contents of this file to
writableStream
. If this FileRef instance refers to a temporary local file created by the SDK, that temporary file is deleted.
Note: This method does not close thewritableStream
.
Parameters:
Name | Type | Description |
---|---|---|
writableStream |
stream.Writable | The destination writable stream. |
Throws:
-
If this FileRef instance does not represent an operation result.
- Type
- Error
(static) createFromURL(urlnon-null) → {FileRef}
- Description:
Creates a FileRef instance from the input URL. As of now, this method is only supported for creation of PDF from HTML using CreatePDFOperation.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | Input URL. |
Returns:
A FileRef instance.
- Type
- FileRef