# File Post-Import

The post-const generatePreviewFile = (file, strings) => {
      // preview file generation logic
      return Buffer.from('');
    };

    const configuration = {
      baseUrl: 'https://123.ngrok.io',
      clientId: 'clientId',
      clientSecret: 'clientSecret',
      name: 'Sample App',
      identifier: 'sample-app',
      description: 'Sample App description',
      dbFolder: import.meta.dirname,
      imagePath: import.meta.dirname + '/logo.png',
      filePostImport: [
        {
          filesFolder: `${import.meta.dirname}/db`,
          signaturePatterns: {
            fileName: "^.+\\..+$",
            fileContent: ".*"
          },
          fileProcess: async ({ request, content: strings, client, context, projectId }) => {

            return {
              strings: [],
              previewFile: generatePreviewFile(request.file, strings),
            };
          }
        }
      ]
    };

    crowdinModule.createApp(configuration);
    ```
  ```ts ins="filePostImport" title="index.ts"
    const generatePreviewFile = (file: ProcessFileRecord, strings: FileImportExportContent): Buffer => {
      // preview file generation logic
      return Buffer.from('');
    };

    const configuration: ClientConfig = {
      baseUrl: 'https://123.ngrok.io',
      clientId: 'clientId',
      clientSecret: 'clientSecret',
      name: 'Sample App',
      identifier: 'sample-app',
      description: 'Sample App description',
      dbFolder: import.meta.dirname,
      imagePath: import.meta.dirname + '/logo.png',
      filePostImport: [
        {
          filesFolder: `${import.meta.dirname}/db`,
          signaturePatterns: {
            fileName: "^.+\\..+$",
            fileContent: ".*"
          },
          fileProcess: async ({ request, content: strings, client, context, projectId }) => {

            return {
              strings: [],
              previewFile: generatePreviewFile(request.file, strings),
            };
          }
        }
      ]
    };

    crowdinModule.createApp(configuration);
    ```
  ## Configuration

| Parameter<div class="w-40"/> | Description                                                                                                                           |
|------------------------------|---------------------------------------------------------------------------------------------------------------------------------------|
| `filesFolder`                | Folder where large files are temporarily stored.                                                                                      |
| `signaturePatterns`          | Contains `fileName` and/or `fileContent` regular expressions used to detect file type when uploading a new source file via UI or API. |

### `fileProcess` Function

This function is called before importing parsed strings into Crowdin.

##### Parameters

- `request` - Request object.
- `content` - Strings to be processed (an array of [`ProcessFileString`](https://support.crowdin.com/developer/crowdin-apps-module-custom-file-format/#strings-array-structure) objects).
- `client` - Crowdin API client.
- `context` - [Context object](/app-project-module/reference/context/).
- `projectId` - Crowdin project ID.

##### Return Value

The function should return an object with the following properties:

```yml
{
  strings: ProcessFileString[];
  previewFile?: Buffer;
  notModified?: boolean;
  error?: string;
}
```

**Description:**

- `strings` - the processed strings (an array of [`ProcessFileString`](https://support.crowdin.com/developer/crowdin-apps-module-custom-file-format/#strings-array-structure) objects).
- `previewFile` - optional, content that will be displayed as a preview in the Crowdin Editor.
- `notModified` - optional, should be set to `true` if the file processor does not make any changes to the file.
- `error` - optional, and should contain an error message if the file processor encounters an error.