# SaveDocumentResult Object

> The callback function argument for the saveDocument and the saveSelection functions.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Object
- **Introduced:** 23.0
- **Path:** DS Server > Reference > JavaScript API > SaveDocumentResult Object
- **432 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/llms-full.txt

---

### Description

The callback function argument for the [saveDocument](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/savedocument-method/llms-full.txt) and the [saveSelection](https://docs.textcontrol.com/ds-server/reference/javascript/txtextcontrol/saveselection-method/llms-full.txt) functions.

### Syntax

```javascript
{
   data: <string>,
   streamType: <StreamType>,
   bytesWritten: <number>
}
```

### Examples

The following example demonstrates `SaveDocumentResult` in a practical document-editing workflow. The callback function argument for the saveDocument and the saveSelection functions.

```javascript
function inspectSaveDocumentResult(saveDocumentResult) {
    console.log("data:", saveDocumentResult.data);
    console.log("stream type:", saveDocumentResult.streamType);
    console.log("bytes written:", saveDocumentResult.bytesWritten);
}
```

---

## In This Section

- [Javascript: SaveDocumentResult.bytesWritten Property](https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/byteswritten-property/llms-full.txt): Specifies the number of bytes written during a save operation.
- [Javascript: SaveDocumentResult.data Property](https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/data-property/llms-full.txt): The Document data. Contains base64 encoded binary data in case of binary document formats (PDF or DOCX, for example) and plain text in case of text based document formats (HTML or RTF, for example).
- [Javascript: SaveDocumentResult.streamType Property](https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/streamtype-property/llms-full.txt): Specifies one of the StreamType values.

---

## Nearby

- **Previous:** [SaveDocumentCallback Function](https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentcallback/llms-full.txt)
- **Next:** [Javascript: SaveDocumentResult.bytesWritten Property](https://docs.textcontrol.com/ds-server/reference/javascript/savedocumentresult/byteswritten-property/llms-full.txt)
