enex-io
v0.1.0
Published
High-performance parser and generator for Evernote/Apple Notes (.enex) files.
Maintainers
Readme
enex-io
High-performance parser and generator for Evernote & Apple Notes (.enex) files.
A lightweight, zero-dependency Node.js library and CLI tool to convert .enex files to JSON and back. Perfect for migrations, backups, and data processing.
📦 Installation
# Install globally for CLI usage
npm install -g enex-io
# Install as a dependency in your project
npm install enex-io💻 CLI Usage
Convert ENEX to JSON
enex-io to-json my-notes.enex
# Output: my-notes.jsonConvert JSON to ENEX
enex-io to-enex backup.json
# Output: backup.enexOptions
-o, --output <path> Specify output file path
-p, --pretty Pretty print JSON output (default: true)
--version Show version number
--help Show help🔧 API Usage
Built for modern Node.js environments (ESM).
import { parseEnex, generateEnex } from 'enex-io';
import fs from 'fs';
// 1. Parse ENEX to Object
const xml = fs.readFileSync('notes.enex', 'utf-8');
const notes = parseEnex(xml);
console.log(notes[0].title); // "My Note"
// 2. Generate ENEX from Object
const myNotes = [
{
title: "Hello World",
content: "<div>This is a <b>test</b>.</div>",
tags: ["personal", "test"],
created: "2023-10-27T10:00:00.000Z",
updated: "2023-10-27T12:00:00.000Z"
}
];
const enexOutput = generateEnex(myNotes);
fs.writeFileSync('export.enex', enexOutput);🧩 Type Definition
The standard Note object used by the parser and generator:
interface Note {
title: string;
content: string; // HTML content string
tags: string[];
created: string; // ISO 8601 Date String
updated: string; // ISO 8601 Date String
author?: string;
sourceUrl?: string;
}License
MIT
{ github.com/mgks }
![]()
