Skip to main content
Skip table of contents

Writing to a File

You can use the Filesystem adapter to write data to a file in the filesystem.

Writing a File

Using the write operation of the Filesystem adapter, you can write a file to the filesystem.

Name

Type

Direction

Description

data

Blob

in

Content you want to write to the file.

name

String

in

Fully qualified file name of the file you want to write, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

position

Integer

in

Position (in Bytes) from which you want to start writing the file.

length

Integer

in

Length (in Bytes) of the data you want to write, if you want to only write part of the Blob.

Replacing the File

Specifying only data and length (optionally), you can write a complete file. If the file is already existing, it will be overwritten with the new content.

Writing Data to a Specified Position in the File

Alternatively, you can use the write operation with the position to write data to a specific position. position defines the byte position within a file to which the new content should be written. Depending on the length of the new data, this will result in a partly update of the file content, and/or an extension of the file.

Related Error Codes

Find a list of all File System Adapter error codes on System Errors of the File System Adapter.

Error Code

Description

FSASDM/22

Failed creating file.
Either the directory where the file should be written to, is missing, or the filename is too long (Windows limitation).

Appending Data to a File

Using the append operation of the Filesystem adapter, you can append data to a file in the filesystem.

Name

Type

Direction

Description

data

Blob

in

Content you want to write to the file.

name

String

in

Fully qualified file name of the file you want to write, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

length

Integer

in

Length (in Bytes) of the data you want to append, if you want to only write part of the Blob.

Modes

You can use the append operation with two modes:

  • append
    If the mode is empty or append, the content stored in data will be appended to the end of the file specified in name. If the file does not exist, it will be created.

  • overwrite
    If mode is overwrite, the file specified in name will be overwritten with the content stored in data. If the file does not exist, it will be created.
    overwrite will only be applied to the first append. For all subsequent appends (e.g. in a loop), the mode will be switched to append automatically.

Closing a File

On end of the service request, all files that have been used with the Filesystem adapter are closed automatically. In some cases, it may be helpful to manually close a file (e.g. if you want to rename or push the file).
You can close a file using the close operation of the Filesystem adapter.

Name

Type

Direction

Description

name

String

in

Fully qualified file name of the file you want to close, including the path.

When using the Windows style with backward slashes "\" you have to be aware that you need to escape this character. The escape character is also the "\".
To avoid this, use forward slashes with Windows as well.

The path and file name of the file you want to close can be given dynamically via input parameter name, or statically via the definitions of an alias

FilesystemAdapter_ProductExport_Example

Click here to download a simple example model that shows the usage of the Filesystem adapter in Scheer PAS Designer.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.