# dayone

> NodeJS Module to create, list and remove Day One Journal entries

Latest version **0.0.4** (published 2014-08-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install dayone
pnpm add dayone
yarn add dayone
bun add dayone
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2014-08-04 |
| First published | 2013-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+4 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Philipp Waldhauer |
| Maintainers | pwaldhauer |
| Keywords | day one |

## Links

- npm: https://www.npmjs.com/package/dayone
- Repository: https://github.com/pwaldhauer/dayone
- Issues: https://github.com/pwaldhauer/dayone/issues
- npm.io page: https://npm.io/package/dayone

## Dependencies (4)

- [hat](https://npm.io/package/hat.md) 0.0.3
- [plist](https://npm.io/package/plist.md) 1.0.1
- [moment](https://npm.io/package/moment.md) 2.8.1
- [path-extra](https://npm.io/package/path-extra.md) 0.2.1

## Recent versions

- 0.0.4 (latest) — 2014-08-04
- 0.0.3 — 2014-02-27
- 0.0.2 — 2013-11-27
- 0.0.1 — 2013-06-23

## README

# dayone

NodeJS Module to create, list and remove [Day One](http://dayoneapp.com/) Journal entries, without using the [Day One command line tools](http://dayoneapp.com/tools/).

## Usage

```javascript
var DayOne = require('dayone').DayOne;
var DayOneEntry = require('dayone').DayOneEntry;

// Basic entry
var entry = new DayOneEntry();
entry.creationDate = new Date();
entry.text = 'Very thoughtful entry!';
entry.tags = ['Test'];

// Attach a photo!
var entryWithPhoto = new DayOneEntry();
entryWithPhoto.text = 'Have a photo!';
entryWithPhoto.photo = new Buffer(fs.readFileSync('photo.jpg'));

var dayone = new DayOne();

dayone.save(entry, function(error) {
    console.log('Saved!');
})
```

Optionally `DayOne()` accepts an object containing a `directory` that should point to the Day One Journal directory. If omitted it will use the iCloud documents directory by default. If it doesn't find the iCloud directory, it will use the Dropbox Application directory.

For more usage examples take a look at the tests or [Elizabeth](https://github.com/pwaldhauer/elizabeth), my script to export your Moves.app data, which uses this module. Surprise!

## Methods

### DayOne#list(options, cb)

Lists all entries in the journal. List may be filtered by tags by passing in `{"tags": ["Tags", "to", "filter", "by"]}` as options. The callback should be a `function(err, entries) {}`.

### DayOne#save(entry, cb)

Saves the given `DayOneEntry`. The callback should be a `function(err) {}`.

### DayOne#remove(uuid, cb)

Removes the entry. The callback should be a `function(err) {}`.

### DayOneEntry

Basically an object with the following fields: `creationDate` (Date), `text` (String), `tags` (Array), `timezone` (String), `starred` (Bool), `UUID` (String), `photo` (Buffer). If the `UUID` is not defined it will be automatically created.

## Contribute

Feel free to contribute! :)

---
_Source: https://npm.io/package/dayone · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
