# שמירת קובץ

> שומר את הקובץ בתיקייה בקבצים, מוכן להורדה, או באחד החיבורים שלכם.

Source: https://docs.go-lumen.ai/he/reference/steps/save-file

## במבט אחד

| מאפיין | ערך |
| --- | --- |
| **שם השלב** | `save-file` |
| **משאב** | ClusterStep (`lumen.ai/v1alpha1`) |
| **קבוצה וקטגוריה** | save, files |
| **קרדיטים** | **1** קרדיט בכל פעם שהוא מצליח |
| **השפעה חיצונית** | כן: הוא משנה משהו מחוץ ל-Lumen, ולכן ניסיון חוזר שואל קודם, ובדיקה מראה מה הוא היה עושה במקום לעשות את זה. |
| **ההתקנה צריכה לספק** | כלום |

## קלט

| מאפיין | ערך |
| --- | --- |
| **צריך** | `file` |
| **מפיק** | כלום |
| **עובד על** | item: מסמך אחד בכל פעם |

״צריך״ ו״מפיק״ הם סוגי נתונים (file, text, fields, email). העורך מציע שלב רק במקום שבו מה שהוא צריך כבר נמצא במסלול. ראו [מסמכים ונתונים](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#documents-and-data).

## פלט

אין פלטים בשם. הצמתים הבאים עדיין רואים את כל מה שהופק קודם במסלול, והשלב מעביר את המסמכים הלאה כמו שהם.

## הגדרות

מגדירים תחת `config:` בצומת של התהליך. הגדרות טקסט יכולות להכיל מצייני מקום כמו `{nodeId.field}`.

| הגדרה | סוג | ברירת מחדל | תיאור |
| --- | --- | --- | --- |
| `destination` | string | `"lumen"` | Destination is where the files go: lumen (the default) or connector. (one of lumen, connector) |
| `connectorRef` | string |  | ConnectorRef names the Connector a connector destination writes to. (minLength 1) |
| `folder` | string |  | Use / for subfolders, `{flow}` for the flow's name and `{date:yyyy-MM}` for the month. Empty saves to Saved/`{flow}`. A file whose name is taken is saved as name (2). (maxLength 200) |
| `ifExists` | string | `"copy"` | Keep both saves the new file as name (2). Replace saves it under the same name and keeps the previous file in .versions. (one of copy, replace) |
| `connectionFolder` | string |  | Under the connection's folder; empty saves there. A file with the same name is saved as its new version, and SharePoint keeps the old versions. (maxLength 200) |

ה-JSON Schema המלא של ההגדרות: [save-file.schema.json](https://docs.go-lumen.ai/schemas/steps/save-file.schema.json).

## דוגמה

```yaml title="config"
destination: lumen
folder: Invoices/{date:yyyy-MM}
```

## שימוש בתהליך

צומת שמריץ את `save-file` נכנס תחת `spec.nodes` של [Flow](https://docs.go-lumen.ai/he/concepts/how-flows-run.md#the-flow-as-yaml). תנו לו כל מזהה, ורשמו ב-next את מזהי הצמתים הבאים.

```yaml title="flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: save-file-example
  namespace: tenant-acme
spec:
  displayName: "Save the file"
  triggers:
    - id: start
      ref: {name: manual-run}
      next: [save-file]
  nodes:
    - id: save-file
      stepRef: {name: save-file}
      config:
        destination: lumen
        folder: Invoices/{date:yyyy-MM}
```
