DocAuthDocumentInput
DocAuthDocumentInput:
type DocAuthDocumentInput =A string, Uint8Array, or ArrayBuffer will be treated as a UTF-8 encoded document authoring document in JSON format and loaded.
An object will be treated as a JavaScript representation of a Document Authoring document (e.g. the result of JSON.parse on a
Document Authoring JSON string). In Node.js, Buffer extends Uint8Array, so a Buffer returned by fs.readFile can be passed
directly.
Examples
Section titled “Examples”// Load from JSONconst docString = '{"version":"7.0","content":[...]}';const docFromString = await system.loadDocument(docString);// Load from a JavaScript objectconst docObject = { version: '7.0', content: [...] };const docFromObject = await system.loadDocument(docObject);// Load from UTF-8 bytesconst bytes = new TextEncoder().encode('{"version":"7.0","content":[...]}');const docFromBytes = await system.loadDocument(bytes);// Load from a Node Bufferconst docBytes = await fs.promises.readFile('document.docjson');const docFromBuffer = await system.loadDocument(docBytes);const fileInput = document.querySelector('input[type="file"]');const blob = fileInput.files[0];const docFromBlob = await system.loadDocument(blob);// Load from a fetch Responseconst response = await fetch('/api/document.json');const docFromResponse = await system.loadDocument(response);const docFromPromise = await system.loadDocument(fetch('/api/document.json'));const blobPromise = fetch('/api/document.json').then((r) => r.blob());const docFromBlobPromise = await system.loadDocument(blobPromise);DocAuthSystem.loadDocumentfor how this is used.- DocJSON guide