data-exporter¶
This module
- exports data from the data-store module as an Obsidian Project File,
- and imports data from an Obsidian Project File to the data-store module.
Using This Module¶
First add the module to your project:
npm install --save @obsidianjs/data-exporter
Then use it in your application (in your main index.js):
const obsidian = require("@obsidianjs/obsidian");
const dataExporter = require("@obsidianjs/data-exporter");
const app = obsidian("my-application");
app.use(dataExporter);
app.start();
Finally require it in modules that need it:
{
    name: "my-module",
    requires: ["data-exporter"],
    load(app) {
        const {dataExporter} = app.modules;
        // ...
    },
    // ...
}
Module API¶
- 
class DataExporter()¶
- Export (and import) data from the data-store module as an Obsidian Project File. - 
DataExporter.export(metadata={}, options={})¶
- Exports data from the data-store module as an Obsidian Project File. - Arguments: - metadata (object) – Metadata that will be stored in the Obsidian Project File.
- options (object) – Options related to the Obsidian Project File generation.
- options.projectType (string) – The type of the project (see Obsidian Project File spec).
- options.metadataFormat (number) – The format of the metadatasection (see Obsidian Project File spec).
- options.projectFormat (number) – The format of the projectsection (see Obsidian Project File spec).
- options.blobIndexFormat (number) – The format of the blobIndexsection (see Obsidian Project File spec).
 - Returns: - Buffer – The Obsidian Project File as a Node.js Buffer. 
 - 
DataExporter.exportAsData64(metadata, options)¶
- Same as the - export()method but returns a data64-encoded string.
 - 
DataExporter.import(obsidianProjectFile)¶
- Imports data from an Obsidian Project file to the data-store module. - Arguments: - obsidianProjectFile (Buffer) – The Obsidian Project File as a Node.js Buffer.
 
 
-