0.6.0 • Published 6 years ago

@davidahouse/lincoln-api v0.6.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

@davidahouse/lincoln-api

npm (scoped) npm bundle size (minified)

API for accessing the Lincoln file storage

Install

$ npm install @davidahouse/lincoln-api

Usage

Configuring the API is easy, just specify the vault you want to interact with by name:

var LincolnVault = require('@davidahouse/lincoln-api')

var vault = new LincolnVault("yourvaultname")

Getting a list of all the vaults can be obtained using the allVaults method:

vault.allVaults(function (err,items) {
    // items is an array of the vault names
})

You can get the path to any of the Lincoln containers by using the pathFor method:

var path = vault.pathFor("Today")

The container names are as follows:

ContainerDescription
InboxThe inbox folder
TodayThe journal folder that points to today's date
Journal/YYYY-MM-DDThe journal folder for a specific date
Content/optional_folder_pathA content container. The folder path represents the folders under the main content root, but is optional
Any other path is assumed to be a virtual folder

You can create a new markdown document using the newDocument method:

vault.newDocument("Glance", "My Document", "## The markdown contents go here")

Use the contents method to get a list of contents in a container:

vault.contents("Today", function(err, items) {
    // items contains an array of content file names
})

Importing files into Lincoln can be done with the importFile method:

vault.importFile("Inbox", "~/Desktop/everythingisfine.png")

You can also create a new file using the newFile method:

vault.newFile("Inbox", "mydoc.txt", "## The markdown contents go here")

The main difference between newFile and newDocument is that newFile lets you specify the full file name, whereas newDocument assumes you are creating a markdown document and provides the .md file extension for you.

0.6.0

6 years ago

0.5.0

6 years ago

0.4.1

7 years ago

0.4.0

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago