vscode#CustomDocumentBackup TypeScript Examples

The following examples show how to use vscode#CustomDocumentBackup. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DrawioEditorProviderBinary.ts    From vscode-drawio with GNU General Public License v3.0 6 votes vote down vote up
public async backup(destination: Uri): Promise<CustomDocumentBackup> {
		const xml = await this.drawioClient.getXml();
		await workspace.fs.writeFile(
			destination,
			BufferImpl.from(xml, "utf-8")
		);
		return {
			id: destination.toString(),
			delete: async () => {
				try {
					await workspace.fs.delete(destination);
				} catch {
					// no op
				}
			},
		};
	}
Example #2
Source File: DrawioEditorProviderBinary.ts    From vscode-drawio with GNU General Public License v3.0 5 votes vote down vote up
public async backupCustomDocument(
		document: DrawioBinaryDocument,
		context: CustomDocumentBackupContext,
		cancellation: CancellationToken
	): Promise<CustomDocumentBackup> {
		return document.backup(context.destination);
	}